0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

PHPのfile_get_contents()でプロキシを指定する

Last updated at Posted at 2021-11-18

PHPのfile_get_contents()でプロキシを設定する方法。

コード
$proxy = array(
    'http' => array(
        'proxy' => 'プロキシサーバーのホスト:プロキシサーバーのポート',
        'request_fulluri' => true,
    ),
);
$proxy_context = stream_context_create($proxy);
return file_get_contents('https://qiita.com', false, $proxy_context);
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?