请知悉:本文最近一次更新为 9年 前,文中内容可能已经过时。

普通代理:

$aContext = array(
'http' => array(
'proxy' => 'tcp://代理IP:代理端口',
'request_fulluri' => true,
),
);
$cxContext = stream_context_create($aContext);
$content = file_get_contents("https://目标网址", False, $cxContext);

有帐号密码的代理:

$auth = base64_encode('登录帐号:密码');
$aContext = array(
'http' => array(
'proxy' => 'tcp://代理IP:代理端口',
'request_fulluri' => true,
'header' => "Proxy-Authorization: Basic $auth",
),
);
$cxContext = stream_context_create($aContext);
$content = file_get_contents("https://目标网址", False, $cxContext);

整理自:https://www.phpfensi.com/php/20140712/3747.html


如您从本文得到了有价值的信息或帮助,请考虑扫描文末二维码捐赠和鼓励。

尊重他人劳动成果。转载请务必附上原文链接,我将感激不尽。


与《PHP-file_get_contents 设置代理方法》相关的博文:


发布时间 01/11/2015 10:19:01栏目 Software.标签 .

留言

avatar
😀
😀😁😂😅😭🤭😋😘🤔😰😱🤪💪👍👎🤝🌹👌