Reputation: 1137
I am experienced with Java and have some experience with PHP (the server scripting language I will be using unless anybody tells me I shouldn't for some reason. I want to just send a string via POST to the server. Because there is not actually a webpage being created, I can't just echo the string if it is received. How should I test if the string was received by the server?
Edit: After further research, it seems like echo doesn't just print to a browser, it sends a string through the http connection to whatever is connected to the php page. I should then be able to echo a response and receive it through an input string on the Java end. Is this correct?
Upvotes: 0
Views: 45
Reputation: 1988
You could use echo
, as you mentioned, but the more common and reusable method of debugging PHP as you progress is the use of error_log()
. You can view its output on the PHP server in the php.log file, commonly found at /tmp/php.log
.
You can watch this file in real-time via the Unix command tail -f /tmp/php.log
.
Further, you can output various forms of data by calling it with print_r()
like error_log(print_r($data, TRUE));
.
Upvotes: 1
Reputation:
I believe you should be properly sending back Responde codes in your php scripts.
Please check: How to send a status code in PHP and Android: How get the status-code of an HttpClient request.
Upvotes: 1