Here’s what I’m trying to do. Using cURL I posted information to a form to login to a website. When a user logs in (and there credentials are authenticated) they are redirected to a site through the Location header. My problem is after logging in through cURL I can’t access the response header.
I’ve tried
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://some.website.com/dirlogin.php'); //login URL
$postData = 'userName=charlie&password=abc&etc....';
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
$store = curl_exec($ch);
$info = curl_getinfo($ch);
print_r($info);
The following is printed out
Array ( [url] => http://some.website.com/dirlogin.php [content_type] => text/html [http_code] => 200 [header_size] => 424 [request_size] => 257 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0.004379 [namelookup_time] => 0.001107 [connect_time] => 0.001655 [pretransfer_time] => 0.001659 [size_upload] => 72 [size_download] => 1712 [speed_download] => 390956 [speed_upload] => 16442 [download_content_length] => 1712 [upload_content_length] => 0 [starttransfer_time] => 0.004213 [redirect_time] => 0 [certinfo] => Array ( ) )
Where’s the Location header? I know there is one because I used Fiddler to view it. I think what’s happening is curl_getinfo($ch) is getting the info of the request I just sent but how to I get the info of the servers response?