$option = array( 'http' => array( 'method' => 'GET', #参照元URLを設定 'header' => 'Referer: '.'http://参照元URL'."\r\n" ) ); $context = stream_context_create($option); #対象URLから$strにファイル内容を取得 $str = file_get_contents('http://対象URL', FALSE, $context);
Just another WordPress site
$option = array( 'http' => array( 'method' => 'GET', #参照元URLを設定 'header' => 'Referer: '.'http://参照元URL'."\r\n" ) ); $context = stream_context_create($option); #対象URLから$strにファイル内容を取得 $str = file_get_contents('http://対象URL', FALSE, $context);