View Single Post
  #1 (permalink)  
Old May 10th, 2012, 05:25 AM
ackid32 ackid32 is offline
Authorized User
Points: 208, Level: 4
Points: 208, Level: 4 Points: 208, Level: 4 Points: 208, Level: 4
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: , , .
Posts: 43
Thanks: 1
Thanked 0 Times in 0 Posts
Default Unable to access web with HttpURLConnection

String https_url = "http://www.google.com/";
URL url;

try {

url = new URL(https_url);
HttpURLConnection con = (HttpURLConnection)url.openConnection();
int responsecode = con.getResponseCode();

} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}

In con.getResponseCode() gives error.
How to solve this?
Reply With Quote