平成30/ 2018-10-22 00:48
php/ user agent 偽造

これか、
ini_set("user_agent", "Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20100101 Firefox/14.0.1");
$url = "google.com";
if (
!$buffer = file_get_contents($url)
) {
    echo "fopen error\n";
    break;
}
echo $buffer. "\n";


これで偽造できる。
$useragent = "Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20100101 Firefox/14.0.1";
$context = stream_context_create(array('http' => array(
'method' => 'GET',
'header' => "User-Agent: {$useragent}\r\n".
    "Host: www.google.co.jp\r\n".
    "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n",
)));
$url = "google.com";
if (
!$buffer = file_get_contents($url, false, $context)
) {
    echo "fopen error\n";
    break;
}
echo $buffer. "\n";

( Thanks. )
stream_context_create
http://php.net/manual/ja/function.stream-context-create.php