PDA

View Full Version : CURL infinite redirect protection


bauhsoj
09-12-2007, 01:31 PM
How could I prevent CURL from getting stuck in an infinite redirect loop in a manner similar to the way Firefox does without limiting overall valid redirects using CURLOPT_MAXREDIRS?

I only want to stop execution if the pages keep redirecting to the same page a max number of times.

mic2100
09-12-2007, 06:38 PM
i suppose you could put a timeout on the script so that i would timeout when stuck in the redirect.


curl_setopt($ch, CURLOPT_TIMEOUT, 900);
curl_setopt($ch, CURLOPT_CONNECTIONTIMEOUT, 30);