dポイントプレゼントキャンペーン実施中!

phpでの質問です。
file_get_contentsなどでファイルを取得できますが、それにreferer(リンク元)を設定したいのです。
どうしたら良いのでしょうか。教えて下さい。
HTTP_clientなどのpearは使えない環境にあります。

A 回答 (1件)

$opts = array(


 'http' => array(
  'method' => "GET",
  'header' => "Referer: http://hoge/\r\n"
 )
);
$context = stream_context_create($opts);

$uri = 'http://hoge2/';
echo file_get_contents($uri, false, $context);

参考URL:http://jp.php.net/manual/ja/function.fopen.php#7 …
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!