I am practicing PHP and sending request on a server using REST Client add-on in Mozilla Firefox. I also tried different tool on chrome to check whether i am receiving data on server but unfortunately i am not receiving anything neither GET or POST. Only thing which i am able to receive is query string.
I didn't even write any code on server side just simple print commands.
<?php
var_dump($_REQUEST);
var_dump($_GET);
var_dump($_POST);
print_r($_GET);
print_r($_POST);
echo "working";
?>
This is INPUT
> This is test message.
And this is output.
array(0) {
}
array(0) {
}
array(0) {
}
Array
(
)
Array
(
)
working
Like is said only thing that works is query string. And this server i am using is free web service don't know if this helps.
This is android code that i am trying to receive.
byte[] jsonBytes = json.getBytes("UTF-8");
URL url = new URL("http://androidapplicati.base.pk/");
urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setRequestMethod("POST");
urlConnection.setDoOutput(true);
urlConnection.setFixedLengthStreamingMode(jsonBytes.length);
urlConnection
.setRequestProperty("Content-Type", "application/json");
urlConnection.setRequestProperty("Content-Length",
String.valueOf(jsonBytes.length));
out = urlConnection.getOutputStream();
out.write(jsonBytes);
out.flush();
urlConnection.getInputStream().read();