1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=> "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3\r\n" .
"Host: www.facebook.com\r\n" .
"Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3\r\n" .
"Accept: image/png,image/*;q=0.8,*/*;q=0.5\r\n" .
"Accept-Encoding: gzip,deflate\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"
)
);
$context = stream_context_create($opts);
$handle = fopen($url[$i], 'r', false, $context);
$contents = '';
while (!feof($handle)) {
$contents .= fread($handle, 2048) or die ("Erreur : fread");
}
fclose($handle); |
Partager