// 要访问的目标页面
$targetUrl = "http://ip.hahado.cn/ip";
//$targetUrl = "http://ip.hahado.cn/switch-ip";
//$targetUrl = "http://ip.hahado.cn/current-ip";
// 代理服务器
define("PROXY_SERVER", "ip.hahado.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);
PHP使用HTTP隧道代码示例
最新推荐文章于 2024-09-30 09:52:28 发布