// 要访问的目标页面标签:USER,result,HTTP,示例,PROXY,context,PASS,华科,define From: https://blog.51cto.com/u_15822686/5753204
// 服务器
define("PROXY_SERVER", "do.cn:39010");
// 隧道身份信息
define("PROXY_USER", "username");
define("PROXY_PASS", "password");
$proxyAuth = base64_encode(PROXY_USER . ":" . PROXY_PASS);
$headers = implode("\r\n", [
"Proxy-Authorization: Basic {$proxyAuth}",
"Proxy-Switch-Ip: yes",
]);
$options = [
"http" => [
"proxy" => $proxyServer,
"header" => $headers,
"method" => "GET",
],
];
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
var_dump($result);