curl-library
RE: login works on all sites but onež
Date: Sun, 20 Jul 2008 15:32:26 -0400
I still need help. I still havent figured out how to log in to THAT site.
hey guys. Very weird behavior
I can log in to all sites except for one.
i
thought maybe my post fields was wrong or missing something. I
recreated it in an html file and tried to login, it worked perfectly. I
also changed the form to GET and copied the data after ? and it was
exactly what i had in my form data.
Last time this was a problem (on
another site), it was because i didnt have a USERAGENT. i thought maybe
CURLOPT_AUTOREFERER was required but that didnt help. Does anyone have
any ideas what it could be? This is my login function
I check cookie.htm to see if my username is on the page (which lets me know if i logged in correctly)
Here is the header i recieved from the page. I hope it helps
HTTP/1.1 200 OK
Date: Thu, 17 Jul 2008 07:04:59 GMT
Server:
Apache/1.3.39 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2
mod_bwlimited/1.4 PHP/4.4.7 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.30
OpenSSL/0.9.7a
X-Powered-By: PHP/4.4.7
Set-Cookie: PHPSESSID=f7a202e125c72571396be1873f0ec0c0; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Transfer-Encoding: chunked
Content-Type: text/html
------------------------------------
void curl_login(const char *url, const char *data)
{
URL_FILE *f = ufile->url_fopen(url, "r");
FILE *f2 = fopen("c:/cookie.htm", "wt");
CURL *login = f->handle.curl;
ufile->curl_easy_setopt(login, CURLOPT_COOKIEJAR, cookieFile);
ufile->curl_easy_setopt(login, CURLOPT_COOKIEFILE, cookieFile);
ufile->curl_easy_setopt(login, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
ufile->curl_easy_setopt(login, CURLOPT_TIMEOUT, 40);
ufile->curl_easy_setopt(login, CURLOPT_URL, url);
ufile->curl_easy_setopt(login, CURLOPT_HEADER, 0);
ufile->curl_easy_setopt(login, CURLOPT_FOLLOWLOCATION, TRUE);
ufile->curl_easy_setopt(login, CURLOPT_POST, TRUE);
ufile->curl_easy_setopt(login, CURLOPT_POSTFIELDS, data);
while(!ufile->url_feof(f))
{
static char page[1024*1024];
int n = ufile->url_fread(page, 1, sizeof(page),f);
fwrite(page,1,n,f2);
}
fclose(f2);
ufile->url_fclose(f);
return;
}
_________________________________________________________________
Received on 2008-07-20