Merge pull request #122 from lehollandaisvolant/master
Ajout d’un UA lors de la récupération d’une page externe
This commit is contained in:
commit
5d48d5d06e
1 changed files with 2 additions and 2 deletions
|
@ -566,7 +566,7 @@ function getHTTP($url,$timeout=30)
|
||||||
{
|
{
|
||||||
try
|
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);
|
$context = stream_context_create($options);
|
||||||
$data=file_get_contents($url,false,$context,-1, 4000000); // We download at most 4 Mb from source.
|
$data=file_get_contents($url,false,$context,-1, 4000000); // We download at most 4 Mb from source.
|
||||||
if (!$data) { return array('HTTP Error',array(),''); }
|
if (!$data) { return array('HTTP Error',array(),''); }
|
||||||
|
|
Loading…
Reference in a new issue