|
< ?php La page de la destination à visiter $url = « http://httpbin.org/ip » ; $urls = « https://httpbin.org/ip » ; Serveurs proxy définir(PROXY_SERVER), « tcp://t.16yun.cn:31111 ») ; Informations d’identité du tunnel définir(PROXY_USER), « 16YUN123 ») ; définir(PROXY_PASS), « 123456 ») ; $proxyAuth = base64_encode(PROXY_USER . ":" . PROXY_PASS) ; Installer le tunnel de procuration $tunnel = rand(1,10000) ; $headers = implode (« \r\n », [ « Autorisation de proxy : Basic {$proxyAuth} », « Tunnel-Proxy : ${tunnel} », ]); $sniServer = parse_url($urls, PHP_URL_HOST) ; $options = [ « http » => [ « proxy » =>PROXY_SERVER, « en-tête » => $headers, « method » => « GET », 'request_fulluri' => vrai, ], 'ssl' => tableau( 'SNI_enabled' => vrai, // Désactiver SNI pour https sur proxies http 'SNI_server_name' => $sniServer ) ]; imprimé($url) ; $context = stream_context_create($options) ; $result = file_get_contents($url, faux, $context) ; var_dump($result) ; Visitez la page HTTPS imprimé($urls) ; $context = stream_context_create($options) ; $result = file_get_contents($urls, faux, $context) ; var_dump($result) ; ?>
|