Prova ad usare una funzione PHP come questa che ho scritto ed uso nel mio sito:
Codice PHP:
function GetPage($host, $port, $page = "")
{
$useragents = array("Mozilla/5.0 (compatible; Konqueror/3.2; Linux) (KHTML, like Gecko)", "Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727)", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; FunWebProducts; SLCC1; .NET CLR 2.0.50727; .NET C", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; InfoPath.2)", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media", "Mozilla/5.0 (Windows; U; Windows NT 6.0; it; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)", "Opera/9.25 (Windows NT 5.1; U; it)", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; ADVPLUGIN|K114|04|S945689328|dial; snprtz|T112494");
$fp = fsockopen($host, $port, $errno, $errstr, 5);
if ($fp)
{
$agent = mt_rand(0,10);
fputs($fp, "GET /" . $page . " HTTP/1.1\r\nUser-Agent: " . $useragents[$agent] . "\r\nHost: " . $host . "\r\n\r\n");
while (!feof($fp))
{
$file .= fgets($fp, 128);
}
fclose ($fp);
}
return $file;
}
//Uso:
echo GetPage("www.google.it", 80);