Facebookのコンテンツをスクレイピング

<?php
$data = file_get_contents('http://hoge.com');

としても対応していないブラウザうんたらかんたらという結果が返ってくる。

<?php
$context = stream_context_create
(
  array
  (
    'http' => array
              (
                'method' => 'GET',
                'header' => 'User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7',
              )
  )
);
$data = file_get_contents('http://hoge.com', false, $context);

これでOK!