From aceab4dc3dc5aa16ec4f19a67a5b4f7cee8672df Mon Sep 17 00:00:00 2001 From: PeaceCopathe Date: Mon, 15 Apr 2013 22:42:04 +0200 Subject: [PATCH] Modif sur la fonction get_external_file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - IntĂ©gration du timeout dans la fonction, je ne pense pas qu'elle ai besoin d'ĂȘtre changer lors de l'appel a la fonction. - petit nettoyage de commentaire. --- inc/functions.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index 45828bf2b..cf06736ca 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -16,8 +16,9 @@ function get_poche_url() } // function define to retrieve url content -function get_external_file($url, $timeout) +function get_external_file($url) { + $timeout=15; // Timeout : time until we stop waiting for the response. // spoofing FireFox 18.0 $useragent="Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0"; @@ -45,10 +46,7 @@ function get_external_file($url, $timeout) } else { // create http context and add timeout and user-agent - $context = stream_context_create(array('http'=>array('timeout' => $timeout, // Timeout : time until we stop waiting for the response. - 'header'=> "User-Agent: ".$useragent, // spoot Mozilla Firefox - 'follow_location' => true - ))); + $context = stream_context_create(array('http'=>array('timeout' => $timeout,'header'=> "User-Agent: ".$useragent,/*spoot Mozilla Firefox*/'follow_location' => true))); // only download page lesser than 4MB $data = @file_get_contents($url, false, $context, -1, 4000000); // We download at most 4 MB from source.