Can't form a simple POST or GET http request. No data returns.
I'm having problems forming an http request in java.
Here's what I do:
I've got a simple php (java.php) file on my apache server, here's it's code:
If I do this request:
$post_var = $_POST['post_var'];
if (!isset($post_var)) $post_var = $_GET['post_var'];
if ($post_var == 1) echo "works";
else echo $post_var . ": post_var";
from browser, I get "works" output. The same if I send POST or GET request from a ActionScript 3 client.
But Java keeps on giving me this:
So, as you can see, it's the output of an "else" block.
And finally, here is the Java code I use to make these requests:
What's wrong with this code?
Re: Can't form a simple POST or GET http request. No data returns.
I've just found the problem myself.
It was the question mark in my request string.
will work as a charm
String request = "post_var=1";