it seems that the fsock part of urlgrabber is not timing out correctly.
The timeout in fsockopen only applies on connecting. See http://de.php.net/manual/en/function.fsockopen.php
timeout
The connection timeout, in seconds.
Note: If you need to set a timeout for reading/writing data over the socket, use stream_set_timeout(), as the timeout parameter to fsockopen() only applies while connecting the socket.
So i grabbed an example from here and implemented it into urlgrabber.
Here is the result:
- Code: Select all
--- C:/Dokumente und Einstellungen/Daniel/Lokale Einstellungen/Temp/functions.lib.php-revBASE.svn000.tmp.php Tue Jan 08 19:43:40 2008
+++ D:/xampp/roster.com/htdocs/lib/functions.lib.php Tue Jan 08 19:43:26 2008
@@ -1226,15 +1226,18 @@
}
$header .= "\r\n";
fwrite($file, $header);
+ stream_set_blocking($file, FALSE );
stream_set_timeout($file, $timeout);
+
+ $info = stream_get_meta_data($file);
$inHeader = true;
$redirect = false;
$resHeader = '';
$tmp = '';
- while( !feof($file) )
+ while( (!feof($file)) && (!$info['timed_out']) )
{
$chunk = fgets($file, 256);
- 1;
+ $info = stream_get_meta_data($file);
if( $inHeader )
{
$pos = strpos($chunk, '<');
@@ -1254,6 +1257,9 @@
$contents .= $chunk;
}
fclose($file);
+ if ($info['timed_out']) {
+ trigger_error("UrlGrabber Error [fsock] timed out", E_USER_WARNING);
+ }
if( preg_match('/(?:Set-Cookie: )(.+)/', $resHeader, $tmp) )
{
$roster->cache->put($tmp[1], $cache_tag);