( Code at the bottom of the message) I logged in to a page, using the Curl-extension. I want to use the vars set in the cookie to continue being logged in and download another page.
In regular Curl, I need to save the headers, containing the cookie information, to a file. In the next step I need to use that file to fake the cookies... In regular Curl I use this to dump the headers to a file: --dump-header "c:\curl\headers.txt" How would I do this using the Curl-extension? Any thoughts? // Tobias //////////////////// // Login $url = "http://mydomain.com/login.php"; $postvars = "user=joeuser&pass=password"; $user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"; $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_POST, 1); curl_setopt ($ch, CURLOPT_POSTFIELDS, $postvars); curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent); // Here I get the headers, but waht to do with them? curl_setopt ($ch, CURLOPT_HEADER, 1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 0); // Somewhere here would be nice to save the cookies to a file curl_exec ($ch); curl_close ($ch); //////////////////// // Download next page $url = "http://mydomain.com/otherpage.php"; $user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"; $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent); curl_setopt ($ch, CURLOPT_HEADER, 1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); // Read the headers in the saved file and use them to fake cookies $result = curl_exec ($ch); curl_close ($ch); echo $result; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php