Connecting to a web server over HTTP, code snippet

Posted by Emanuil on Stack Overflow See other posts from Stack Overflow or by Emanuil
Published on 2010-06-10T08:03:13Z Indexed on 2010/06/10 8:22 UTC
Read the original article Hit count: 244

Filed under:
|

I'v got the following piece of code:

try {
    HttpClient httpClient = new DefaultHttpClient();
    HttpPost httpPost = new HttpPost("http://www.flashstall.com/json.txt");
    HttpResponse httpResponse = httpClient.execute(httpPost);
} catch (Exception e) {
    Log.e("m40", "Error in http connection " + e.toString());
}

When I run it it logs "Error in http connection java.net.UnkownHostException: www.flashstall.com".

What am I doing wrong?

© Stack Overflow or respective owner

Related posts about android

Related posts about http