Amazon Gift Cards

Sunday, June 7, 2009

Trace your post data in server side using HttpPost in Android

By default you could trace your variables or your post data (or even get data) using breakpoints, but after that what happens between android and your server is a bit hard to trace specially if somewhere a long the way there's an error on your post data. This piece of code is from my flash experiences where the firebug or httpwatch or even charles cannot see the flash requesting the server. This is done on php but it could be used on other server side languages since its just echo command from linux based or mac or unix based os.
exec("echo '". addslashes(print_r($_REQUEST,true)) . addslashes(print_r($_FILES,true)). "' > /Applications/xampp/htdocs/something.out");

As you can see it will print the array and echo that array to something.out. You could open something.out with vi or any texteditor.

* There are some servers that cannot use exec, for this you have to call your System Administrator
* For java, take a look at Runtime, there is something like runtime.exec("command")

No comments: