Appending key/value data to URLs after a '?' is GET not POST.
This is how to POST data in Java:
String urlText = "http://www.myserver.com/myservice.php";
String postContent = "location_data=[{\"key1\":\"val1\",\"key2\":\"val2\"}]";
try {
HttpURLConnection c = (HttpURLConnection) new URL(urlText).openConnection();
c.setDoOutput(true);
OutputStreamWriter writer = new OutputStreamWriter(c.getOutputStream(), "UTF-8");
writer.write(postContent);
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
Jim Blackler
2010-04-08 06:25:42