cURL / Mailing Lists / curl-library / Single Mail

curl-library

Libcurl not redirecting.....

From: John Zadeh <zadeh79_at_hotmail.com>
Date: Thu, 29 Apr 2010 21:09:34 -0500

A comparison of my CURLOPT_WRITEHEADER output, with HTTP Live Headers, suggests that I am not being redirected from the main page. Perhaps, someone can help me out with this. I would appreciate it.

*****************PARTIAL OUTPUT FROM HTTP LIVE HEADERS**************************************

https://www.53.com/wps/portal/personal

GET /wps/portal/personal HTTP/1.1
Host: www.53.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Cookie: visitor_id=74.4.195.92.1271990209279159; survey=nosurvey; PORTAL51_JSESSIONID=0000MMoiMeDhQHJkDjpggboMHni:12kan52r1; Server_www.53.com_https=1890734808.47873.0000
Cache-Control: max-age=0

HTTP/1.1 200 OK
Date: Thu, 29 Apr 2010 22:45:33 GMT
Server: IBM_HTTP_Server
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Pragma: no-cache
Vary: User-Agent,Cookie
Keep-Alive: timeout=15, max=491
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8

----------------------------------------------------------
https://www.53.com/style/portal_style/style.css

GET /style/portal_style/style.css HTTP/1.1
Host: www.53.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729)
Accept: text/css,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: https://www.53.com/wps/portal/personal
Cookie: visitor_id=74.4.195.92.1271990209279159; survey=nosurvey; PORTAL51_JSESSIONID=0000MMoiMeDhQHJkDjpggboMHni:12kan52r1; Server_www.53.com_https=1890734808.47873.0000
If-Modified-Since: Wed, 28 Apr 2010 20:40:03 GMT
If-None-Match: "fae0-688a-3b74ec0"
Cache-Control: max-age=0

HTTP/1.1 304 Not Modified
Date: Thu, 29 Apr 2010 22:45:33 GMT
Server: IBM_HTTP_Server
Connection: Keep-Alive
Keep-Alive: timeout=15, max=490
Etag: "fae0-688a-3b74ec0"
----------------------------------------------------------

***********HEADER OUTPUT FILE*******************************************************

HTTP/1.1 200 OK
Date: Fri, 30 Apr 2010 01:39:08
GMT Server: IBM_HTTP_Server
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Pragma: no-cache
Vary: User-Agent,Cookie
Transfer-Encoding: chunked
Content-Type: text/html;
charset=UTF-8
X-Pad: avoid browser bug

******************************LIBCURL CODE*******************************************

if (starting < 2)
{
FILE *outfile;
outfile = fopen("outfile", "w");

FILE *curldebug;
curldebug = fopen("curldebug", "w");

FILE *headfile;
headfile = fopen("headfile", "w");

struct data config;

CURL *curl;
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_write_func);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, outfile);
curl_easy_setopt(curl, CURLOPT_COOKIEJAR, "cookies");
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "cookies");
curl_easy_setopt(curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729)");
curl_easy_setopt(curl, CURLOPT_VERBOSE, TRUE);
curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, my_trace);
curl_easy_setopt(curl, CURLOPT_DEBUGDATA, &config);

curl_easy_setopt(curl, CURLOPT_WRITEHEADER, headfile);

//curl_easy_setopt(curl,CURLOPT_CAPATH, "C:\testprog");

//curl_easy_setopt(curl,CURLOPT_SSLCERT, "cacert.pem");
curl_easy_setopt(curl,CURLOPT_CAINFO, "cacert.pem");

//curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER , 2);
//curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST , 2);

curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(curl, CURLOPT_AUTOREFERER, 1);
curl_easy_setopt(curl, CURLOPT_URL, "https://www.53.com/wps/portal/personal");

curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "fp_browser=;fp_display=;fp_software=;fp_timezone=;fp_lang=;fp_syslang=;fp_userlang=;fp_cookie=;UserName=john&Password=kick&action=https://www.53.com/wps/portal/personal/servlet/logon");

if (curl_easy_perform(curl) == 0)
{
deal = 1;
}

curl_easy_cleanup(curl);
}
                                               
_________________________________________________________________
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-04-30