http://www.xxx.com
上記サイトの情報をPHPで取得したいと思います。
User-Agentを指定しても
403 Forbidden
になります。
php
1 $url = 'http://www.xxx.com'; 2 $context = stream_context_create(array('http' => array( 3 'method' => 'GET', 4 'header' => 'User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)', 5 ))); 6 $res = file_get_contents($url, false, $context); 7 8 echo $res;
ちなみにコンソルのwgetでもだめでした。
linux
1# wget --user-agent="Mozilla" http://www.xxx.com
browserでは見れます。
何が問題でしょうか?
よろしくお願いいたします。
回答1件
あなたの回答
tips
プレビュー