I'm building a PHP server that responds to http GET/POST requests from mobile applications.
I'm fairly ok with using xdebug to debug http requests that are initiated via my browser etc. Using xdebug if I enter a url in my browser and set an appropriate breakpoint in PHPStorm - there's no problem.
How do you do it for a non-browser request ? In my case I'm writing an iPhone / Android app that collects GPS location data and then POSTs the data via HTTP after JSON and urlencoding to my server for storage/analysis.
Running my app in the XCode simulator or Eclipse for example I can get an idea of what the server thinks it received from my app by echoing back what it received with an HTTPResponse.
What are the alternatives? Do I just have to log the incoming content data to file on my server, or is it possible to set breakpoints using an alternative to xdebug ?
Would appreciate any tips or pointers! Thanks!
By using a debugging proxy such as Charles (http://www.charlesproxy.com/), you can set your mobile device to route requests through the proxy application.
You can then view the request and response headers and body.
Charles also provides various helpful features such as allowing you to edit and repeat requests.
Related
So I've been literally 2 months searching for this but nothing... Basically I've got an Android app witch makes HTTP(S) requests to a PHP server. Let's say I've got a URL to get some information: https://example.com/username/check/whaterver/, to access this URL you need to send over a token that you get once you're logged in. I have everythig all set, the only problem is that I know that people can see the requests made from their phones, let's say: URL: https://example.com Form-data: token=5456432145. What I need is a way to send the token to the server without the user being able to see the token.
I am not asking how to make a HTTP request between Android and PHP, I'm asking how to ONLY accept HTTP requests from Android and PHP
You can use/create a cryptography to send to PHP server and from server to browser of device. A cryptography mode will encode your token code.
Like: token=5456432145 to token=D37AG3H7183BAD2E6DGAS
I wrote PHP code that allows me to communicate with a REST API.
My PHP call issues a cURL call to communicate with the API service. However, I am running into a weird issue where the data that is being received by the API is not what is being sent using cURL.
I would like to setup some type of a middle man to ensure that the request that I send to from Apache is the same data that is received by the API.
The information that I am interested to see is
Request/Received Header
Request/Received Body
I am thinking about ruining Wireshark on the Apache server to capture the packets that are going from my Apache to the API and also everything that is being received from the API to Apache.
After installing Wireshark on the Apache server "a Windows 7 machine" I see a lot of data.
How can I tell Wireshark to only capture the data from Apache to the API and from the API to Apache only?
Thank you for your help.
There are many tools for API tsting, starting from very easy to use browser plugins and finishing with someting quite complicated as Apache Jmeter. The idea is to make the calls from your testing software to the API and analyse the request and response. if you are on windows you can use something like Fiddler to intercept the packages that are going out from your machine. If you have access to client server I assume there are tools for various OS to intercept the outgoing packages and analyse them, but you would have to google for those.
to filter HTTP results in Wireshark, just type http in the filter field and click Apply
to have a better look, just start th capture before the HTTP request and stop it juste after
afterward, if you know the IP of the API server, you can filter a step more with :
http && ip.dst == X.X.X.X
I am sending packets of data to a desktop application using PHP Curl, this works using a specific IP address and port to request and post information.
What I need to do now is the opposite and send information from a desktop application and process them on the web as soon as I receive them.
The information will be sent in XML format.
I've been looking into how I can achieve this and so far I have come across NuSOAP and PHP. I am just wondering if this is the way forward to achieve what it is I need to do.
As much information would be great! Thanks
This is actually a one-liner in php:
$xml = simplexml_load_file('php://input');
This assumes that
php is running behind a web server (typically, Apache)
the request is a standard HTTP POST request
xml data is sent raw in a request body
Setup on my server is a set of PHP scripts which when run will interface with a MySQL database and return information in the form of a HTML response. I want my android application to be able to 'navigate' to one of these pages and post/get the information required for validation and the query, and then get a response.
I cant find out how to get the HTML response information from a browser or find any other method to do this communication. I cannot connect directly with the SQL database as the php scripts are the interface for an application and website also and I want to connect all platforms through the php scripts.
Does anyone know of a means by which I can communicate with the PHP server and read the response details?
Delphi ships with Indy preinstalled. Indy works on mobile platforms, including Android. You can use Indy's TIdHTTP component to send HTTP GET and POST requests to your webserver as needed. Response data can be given to you as either a String (which TIdHTTP will decode to UTF-16 for you) or a TStream (raw data).
I am trying to write a Sencha Touch application that I can package in PhoneGap for iOS, Android etc...
The app allows you to input some data which I would like to save to my backend server using PHP/MySQL. It all works when I use an AJAX proxy as I am testing the app on the same server as my database.
However when I package it for mobile devices I run into the same-domain restrictions of AJAX calls. So I modified it to use the JSONP proxy and I can read the data from the server database but have no idea how to write records back. Do I need to somehow pass the data in the GET request? Obviously the server side PHP needs to be different because of the callbacks and the fact JSONP is forced to used GET requests. I am also trying to get CORS working but currently no success.
So my question is how would I implement writing data back to my backend server from a packaged mobile Sencha app running on a mobile device? Either using JSONP if that is even possible or any other alternatives are welcome?
Many Thanks…