I am trying to create a program that registers on a site and performs some automated actions. I am using HttpClient 4.0.1 and using this to start: http://hc.apache.org/httpcomponents-client/primer.html .
On this particular site, cookies are not set via the "set-cookie" header, but in javascript.
So far, I have not been able to sign in.
I have tried the following things:
- manually add headers for all request headers that appear in firebug
NameValuePair [] data = {
new BasicNameValuePair ("Host", host),
new BasicNameValuePair ("User-Agent", "Mozilla / 5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv: 1.9.1.7) Gecko / 20091221 Firefox / 3.5.7"),
new BasicNameValuePair ("Accept", "text / html, application / xhtml + xml, application / xml; q = 0.9, * / *; q = 0.8"),
new BasicNameValuePair ("Accept-Language", "en-us, en; q = 0.5"),
new BasicNameValuePair ("Accept-Encoding", "gzip, deflate"),
new BasicNameValuePair ("Accept-Charset", "ISO-8859-1, utf-8; q = 0.7, *; q = 0.7"),
new BasicNameValuePair ("Keep-Alive", "300"),
new BasicNameValuePair ("Connection", "keep-alive"),
new BasicNameValuePair ("Referer", referer),
new BasicNameValuePair ("Cookie", cookiestr)
};
for (NameValuePair pair: data) {
loginPost.addHeader (pair.getName (), pair.getValue ());
}
- BasicClientCookies setCookieStore. , , , cookie . , , ? (, ..).
, : HTTP/1.1 417
, - , ? , , .