X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fremote_url.inc;h=5c6790aee3f0bc6b03779daf8eecb6cceb0a8e6c;hb=25379bdc9f10bda4aae4b37f04d16eb1bbe7e4f6;hp=0e53dbf466eab1cc32445cd9ca935f1d8c919504;hpb=492ffc218180456791e330e075a098ce320411e8;p=fa-stable.git diff --git a/includes/remote_url.inc b/includes/remote_url.inc index 0e53dbf4..5c6790ae 100644 --- a/includes/remote_url.inc +++ b/includes/remote_url.inc @@ -43,7 +43,6 @@ function url_get_contents($url, $timeout=10) } $response = ''; - // connect to the remote server $fp = @fsockopen($host, $port, $errno, $errstr, $timeout ); if( !$fp ) { @@ -58,20 +57,12 @@ function url_get_contents($url, $timeout=10) "Accept: */*\r\n" . "Accept-Language: en-us,en;q=0.5\r\n" . "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n" . - "Keep-Alive: 300\r\n" . - "Connection: keep-alive\r\n" . + "Connection: close\r\n" . "Referer: http://$host\r\n\r\n"); // retrieve the response from the remote server - $unblocked=0; - while ($line = fread($fp, 4096)) { - $response .= $line; - if ($host=='localhost' && !$unblocked++) - stream_set_blocking($fp, 0); // just after connection switch to nonblocking mode - usleep(10); - } - fclose( $fp ); + $response = stream_get_contents($fp); if (!strpos($response, "200 OK\r\n")) return null;