How To Post A Form With Some Cookie
i have posted a question for htmlunit in this link: how to use htmlunit with my android project mainly i have a link, which i have get after login (i have login through web view) t
Solution 1:
this is the same answer which i have given here
i have solve the problem. first of all i was getting the right cookie all time. so what was the problem then. either i was wrong to integrate the cookie with Jsoup or Jsoup was doing something wrong. so, first i have get the page with HttpUrlConnection and then parse it with Jsoup. like this:
URLform=newURL(uri.toString());
HttpUrlConnectionconnection1= (HttpURLConnection)form.openConnection();
connection1.setRequestProperty("Cookie", my_cookie);
connection1.setReadTimeout(10000);
StringBuilderwhole=newStringBuilder();
BufferedReaderin=newBufferedReader(
newInputStreamReader(newBufferedInputStream(connection1.getInputStream())));
String inputLine;
while ((inputLine = in.readLine()) != null)
whole.append(inputLine);
in.close();
Documentdoc= Jsoup.parse(whole.toString());
any advice about this code would be appreciated.
Post a Comment for "How To Post A Form With Some Cookie"