Görünüşe göre, bu özel durumda, Facebook sadece HTTP Üstbilgi "User-Agent" için test edilmiştir.
Bana kullanarak optons bir çok ayarlamanızı sağlar curl dayalı kod bu bölümünü, istimal ederse curl_setopt a>:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.facebook.com/index.php");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$html = curl_exec($ch);
curl_close($ch);
echo $html;
Ben senin gibi aynı mesajı alıyorum.
But, if I try sending a User-Agent that correspond to Firefox (I just copy-pasted the one my real Firefox is actually sending) :
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.facebook.com/index.php");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.3) Gecko/20090910 Ubuntu/9.04 (jaunty) Shiretoko/3.5.3");
$html = curl_exec($ch);
curl_close($ch);
echo $html;
Ben gerçek bir Facebook ana sayfasını değil, uyumsuz tarayıcı hakkında bu hata mesajı alıyorum.
Of course, this will not solve the problem of Javascript not being executed...
Ama ... Bir tarayıcı olmadan Javascript yürütme oldukça zor bir şeydir (not even google solved it ^^ )
Bir tarayıcı olmadan JavaScript kodu çalıştırmasına izin motorlar) PHP için, (rhino, for instance ; or the Spidermonkey PECL extension vardır em>; ama onlar Javascript kodu çalıştırmak için izin bile, web dayandığı tarayıcısı tarafından sağlanan tüm çevre ve yöntemleri var olmaz ...
An idea, if you need to crawl a Javascript-dependant website, might be to use Selenium, which opens a real browser (ie, firefox, or other), controling it from your PHP code via Selenium RC.
Ama bu grafiksel bir ortam olması gerektiği anlamına gelir, ve bir tarayıcı, size PHP makinede; Bu da oldukça ağır ve yavaş - sadece ^ ^ Bir web sayfası yüklenirken çok daha yavaş