I'm working on application that i want to store the coordinates to a local Database (wampserver) so I've done the php script and it works , but my problem is to execute that script.php from my app with HTTP GET method.
I've found this code but it doesn't work !! so please i need your help and thank you!
Link to the HTTP Get code --> : http://www.softwarepassion.com/android-series-get-post-and-multipart-post-requests/
Please be more specific. What doesn't work? This code is what you can use to make an HTTP GET request:
HttpClient httpClient = new DefaultHttpClient();
String url = "http://www.mywebsite.com/script.php";
HttpGet httpGet = new HttpGet(url);
try {
HttpResponse response = httpClient.execute(httpGet);
StatusLine statusLine = response.getStatusLine();
if (statusLine.getStatusCode() == HttpStatus.SC_OK) {
HttpEntity entity = response.getEntity();
ByteArrayOutputStream out = new ByteArrayOutputStream();
entity.writeTo(out);
out.close();
String responseStr = out.toString();
// do something with response
} else {
// handle bad response
}
} catch (ClientProtocolException e) {
// handle exception
} catch (IOException e) {
// handle exception
}
AndroidManifest.xml
- Tyler Treat 2012-04-04 21:07
this is my code --> : http://pastebin.com/L9SndTH - Jamel Naghmouchi 2012-04-04 22:06