Hi,
I currently have a script that loads a page on my clients other server using cURL. Currently, the settings are
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
curl_setopt($ch,CURLOPT_USERAGENT,$useragent);
curl_setopt($ch, CURLOPT_HEADER, 0);
$usecookie = ROOT_PATH . "/public_html/football_parser/cookie.txt";
if($usecookie) {
if (!is_writable($usecookie)) {
return "Can't write to $usecookie cookie file, change file permission to 777 or remove read only for windows.";
}
curl_setopt($ch, CURLOPT_COOKIEJAR, $usecookie);
curl_setopt($ch, CURLOPT_COOKIEFILE, $usecookie);
}
$output = curl_exec($ch);
I'm trying to load the two example urls
statto.com/football/teams/newcastle-united/2005-2006/results
and
statto.com/football/teams/newcastle-united/2008-2009/results
The second loads without any problems. The first fails to load without curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE)
being set. When it does load however, it redirects to an error page, but it is fine in my brower. I've been told that there is a 307 redirect on this page that switches between the page I see in my browser and the 404 error page I get in cURL. I can make this error page appear in my browser if I delete the cookie UID, but I've checked the cookie file on my server and it seems to be set ok and present.
Can anyone tell me how I would cURL the first url and see what I see in my browser, not the 404 redirect?
Many Thanks
Michelle