Ajout d’un UA lors de la récupération d’une page externe (certains site veulent un UA)

This commit is contained in:
lehollandaisvolant 2013-09-03 15:55:13 +02:00 committed by Knah Tsaeb
parent 7e929771eb
commit fb57aab74d

View file

@ -578,7 +578,7 @@ function getHTTP($url,$timeout=30)
{
try
{
$options = array('http'=>array('method'=>'GET','timeout' => $timeout)); // Force network timeout
$options = array('http'=>array('method'=>'GET','timeout' => $timeout, 'user_agent' => 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0')); // Force network timeout
$context = stream_context_create($options);
$data=file_get_contents($url,false,$context,-1, 4000000); // We download at most 4 Mb from source.
if (!$data) { return array('HTTP Error',array(),''); }
@ -2474,4 +2474,4 @@ if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=d
if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'ws=')) { processWS(); exit; } // Webservices (for jQuery/jQueryUI)
if (!isset($_SESSION['LINKS_PER_PAGE'])) $_SESSION['LINKS_PER_PAGE']=$GLOBALS['config']['LINKS_PER_PAGE'];
renderPage();
?>
?>