Skip to content

Instantly share code, notes, and snippets.

@narita1980
Created March 13, 2013 07:29
Show Gist options
  • Save narita1980/5149985 to your computer and use it in GitHub Desktop.
Save narita1980/5149985 to your computer and use it in GitHub Desktop.
proxy経由でfile_get_contentsを利用する方法 [参考サイト] http://www.php.net/manual/ja/function.file-get-contents.php#58758
<?php
$proxy = array(
'http' => array(
'proxy' => 'tcp://127.0.0.1:8080',
'request_fulluri' => True,
),
);
$context = stream_context_create($proxy);
// Now all file stream functions can use this context.
$sFile = file_get_contents("http://www.php.net", False, $context);
echo $sFile;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment