I currently have a script that loads my client using curls on another server Currently, the settings < / P>
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 "$ usecookie can not write cookie file, change the file's permission to 777 or read only for windows."; } Curl_setopt ($ ch, CURLOPT_COOKIEJAR, $ usecookie); Curl_setopt ($ ch, CURLOPT_COOKIEFILE, $ usecookie); } $ Output = curl_xac ($ ch);
I'm trying to load two example URLs
statto.com/football/teams/newcastle-united/2005-2006/results
and
statto.com/football/teams/newcastle-united/2008-2009/results
Without a second load without any problems curl_setopt ($ ch, CURLOPT_FOLLOWLOCATION, TRUE)
fails to load without setting. When it loads, it redirects to an error page, but it's okay in my browser. I have been told that there is a 307 redirect on this page, which switches between the pages viewed in my browser and the 404 error page. That's what I get in curl. If I delete the cookie id I can reveal this error page in my browser, but I have checked the cookie file on my server and it seems that it is OK and exists.
Can anyone tell me how I first curl the url and see what I'm seeing in my browser, not a 404 redirect?
Many thanks
Michelle
when I see My browser has the following url in the hidden cookie jar:
307 redirection cache-control: post check = 0, pre-check = 0 cache-control: no-store , No-cache, sure-modify Connection: Keep-alive content-encoding: gzip content-length: 20 content-type: text / html Date: Mon, 10 September 2012 08:30:40 GMT Expiration: Mon, Sept. 10 2012 08:30:40 GMT Keep Elive: Timeout = 5, Max = 50 Last-Modified: Mon, 10 Sep 2012 08:30:40 GMT Location: Home / Error / 404 MS Writer-Via: DAV Proga: No-Cache Server: Apache Set-Cookie : Option = DD0505030; Expiration = Tuesdays, 10-Sep-2013 08:30:40 GMT; Path = /; Domain = www.statto.com set-cookie: UID = 3bdb30f60000-00-00USbf62da837b5bb608f95715dea80a8efa; Expiration = Tuesday, 30 October 2012 08:30:40 GMT; Path = /; Domain = www.statto.com Variant: Accept-Encoding X-Powered-By: PleskLin X-Robot-Tag: Index, Neurivive
As you can see, Location: / Home / error / 404 In this way this behavior is due to the fact that this website has made a mistake (I do not consider any possible reason for correct behavior). Anyway, to compensate for your mistake, you must first set up the cookie (request on this page and redirect to the 404 error page) and then request that the cookie that you previously generated was nearby.
Hopefully you can do this:
$ output = curl_x one ($ ch); $ Output = curl_xac ($ CH);
I can not really remember that if the curl handle needs to be reset or something else, if it does not work then you can add another Try to handle the curl and execute it after performing your first curl handle.
Comments
Post a Comment