Curl redirection problem.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ave,

I¹m using Curl to login to a website. I gather cookies from one page, carry
the cookiejar to another page, post data to login, and get the result. The
problem is, the final landing page displays on my php page as part of the
page and remains on my server, therefore the Links on that Landing page are
malformed as they are carrying my Server.

I want to redirect to the Landing page altogether. How do I do that?
Here¹s my code:

$curl = curl_init();
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, false);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01;
Windows NT 5.0)");
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_COOKIEFILE,
"/Library/WebServer/Documents/Misc/curl/garbage/wbCookieFile");
curl_setopt($curl, CURLOPT_COOKIEJAR,
"/Library/WebServer/Documents/Misc/curl/garbage/wbCookieFile");
curl_setopt($curl, CURLOPT_POSTFIELDS, "username=usr&password=pwd");
curl_setopt($curl, CURLOPT_URL, "http://www.website.org/login.php";);
$xxx = curl_exec($curl);
curl_setopt($curl, CURLOPT_URL, "http://www.website.org/index.php";);
curl_setopt($curl, CURLOPT_POSTFIELDS, "username=usr&password=pwd");
$xxx = curl_exec($curl);
curl_close ($curl);

Basically I want to redirect to: http://www.website.org/index.php after
logging in using curl.

Thanks.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rahul Sitaram Johari
CEO, Twenty Four Seventy Nine Inc.

W: http://www.rahulsjohari.com
E: sleepwalker@xxxxxxxxxxxxxxxx

³I morti non sono piu soli ... The dead are no longer lonely²


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux