Skip to content Skip to sidebar Skip to footer

Android Call Php With Http-get

My question is: How to call a php with HttpPost? final HttpClient httpclient = new DefaultHttpClient(); final HttpPost httppost = new HttpPost('www.example.de/mySkript.php'); fina

Solution 1:

You need to make HTTP GET request to your server, you can use something like:

publicstatic HttpResponse hitUrl(String url) {
  try {
    HttpClienthttpclient=newDefaultHttpClient();
    HttpResponseresponse= httpclient.execute(newHttpGet(url));
    return response;
  } catch (Exception e) {
    Log.("[GET REQUEST]", "Network exception", e);
    returnnull;
  }
}

I can also recommend AQuery library for this server asynchronous calls:

http://code.google.com/p/android-query/

Post a Comment for "Android Call Php With Http-get"