I got your suggestion
This means that
String location =httpConnection.getHeaderField("Location"); gives redirected url.
Some sites provide their url which redirects to another url (actual url) or we
can say that some sites doesnt gave direct access to their url.So, we are
accessing those sites indirectly.when we enter url in browser it automatically access redirected url & opens page but in code when we create httpconnection & gave it in url, it doesnt automatically opens redirected url.
So, we get redirected url from getHeaderField() , create another httpconnection object & gave it redirected url like this:
HttpsConnection httpconn = null;
HttpsConnection hc = null;
InputStream is = null;
httpConn = (HttpsConnection) Connector.open(url);
String location =httpConn.getHeaderField("Location");
hc = (HttpsConnection) Connector.open(location);
is = hc.openDataInputStream();
I havent implemented this change to my code yet. But I think now response
code must be 200 because i am creating another httpconnection object &
giving it redirected url.
Let me make this change to my code