I'm using cURL from within a PHP webpage to display some RSS feeds on my site. I'm displaying comics from the xkcd feed and the Dilbert feed. The xkcd feed works perfectly, but Dilbert does something very strange.
At certain times of day Dilbert works fine, but at other times it does a 302 redirect to a different page with an older comic on it. However, only cURL seems to get this 302 redirect. When you paste the url into Firefox, you get the current comic!
This is really confusing me as I'm not sure whether the problem is in my code or in the Dilbert RSS feed. It's happened consistently for the last three days though. It works fine from around 11:00pm (GMT) to around 11:00am (GMT), and does the redirect from 11am until 11pm. (The times are only very rough, I haven't tracked them down precisely.)
The url I am using for the Dilbert feed is:
http://feeds.feedburner.com/DilbertDailyStrip?format=xmland the one it redirects to is:
http://feedproxy.feedburner.com/DilbertDailyStrip?format=xmlMy cURL code is:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $feedURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
$out = fopen('out '.urlencode($feedURL).time().'.txt', 'w');
curl_setopt($ch, CURLOPT_STDERR, $out);
$buffer = curl_exec($ch);
curl_close($ch);
fclose($out);
Hopefully, someone may be able to shed some light on this - it's really puzzling me!


Sign In
Create Account


Back to top









