cURL Çerez ve 307 yönlendirme sorunu

0 Cevap php

Şu vea benim müşteriler diğer sunucu cURL kullanarak bir sayfa yükleyen bir komut dosyası var. Şu vea, ayarlar

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);

Ben iki örnek adresler yüklemeye çalışıyorum

statto.com/football/teams/newcastle-united/2005-2006/results

ve

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 ve 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 ve it seems to be set ok ve present.

Can anyone tell me how I would cURL the first url ve see what I see in my browser, not the 404 redirect?

Çok teşekkürler

Michelle

0 Cevap