views:

71

answers:

2

HI, i am doing a HttpUrlConnection in android application with an URL. The uRL is giving me response in the browser but in the android code InputStream returning zero. this is my code.....

URL url = new URL("https://certify.securenet.com/payment.scrnt");

    HttpURLConnection httpCon = (HttpURLConnection)url.openConnection();
    InputStream in = httpCon.getInputStream();

    byte content[] = new byte[in.available()];
    in.read(content,0,content.length);
    String receivedString = new String(content);
    Log.d("Received Stringggggg",receivedString)
A: 

I suppose that you have to use HttpsUrlConnection for URLs with https scheme.

brambury
A: 

Try changing from "https://" to "http://" in the URL if you don't need a secure connection.
Or try changing to HttpsUrlconnection instead of HttpUrlconnection.

BlackDragonBE
Thanks it working
Sujit