cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: Prevent curl from timeout?

From: Niklas Forsberg <foppa_at_subgate.mine.nu>
Date: Fri, 31 Mar 2006 09:03:42 +0200

Yeah, here is the curl-thingie I use inside my code:

The foreach-loop loops 1,000 times since the $result-array
contains 1,000 indexes.

<?php

$ch = curl_init();
foreach ($result as $gamedata) {
        $url = 'http://www.foo.com' . $gamedata['url'];
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_TIMEOUT, 30);
        curl_setopt($ch, CURLOPT_NOPROGRESS, FALSE);
        curl_setopt($ch, CURLOPT_MAXCONNECTS, 1);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
        $gamedata_src = curl_exec ($ch);
}
curl_close($ch);

?>

Kevin Carothers skrev:
>
> On 3/30/06, *Niklas Forsberg* <foppa_at_subgate.mine.nu
> <mailto:foppa_at_subgate.mine.nu>> wrote:
>
> Hey I am using curl to get source of a HTML-document in a loop
> that loops through about 1,000 pages. It works nice in the
> beginning...
>
> But for some reason it times out... What I get is:
>
> 0 156k 0 0 0 0 0 0 --:--:-- 0:05:51
> --:--:-- 0
>
>
> And the counter just counts on forever...
> How can I fix this?
>
>
>
> Got any code?
> If not, my 1st choice is to say it's the web server's fault- or
> something to do with your LAN.... but obviously that's just a shot in
> the dark.
>
> KC
>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2006-03-31