mrmax2000 Posted August 18, 2017 Share Posted August 18, 2017 (edited) Hi, I need help to use curl HTTPS in proxy. This is my code $url = 'https://curl.haxx.se'; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_NOBODY, false); curl_setopt($ch, CURLOPT_ENCODING,'gzip,deflate' ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1); curl_setopt($ch, CURLOPT_PROXY,'138.204.145.39:80'); curl_setopt($ch, CURLOPT_VERBOSE , true); $verbose = fopen('e.txt', 'w+'); curl_setopt($ch, CURLOPT_STDERR, $verbose); $r=curl_exec($ch);echo $r; and this is verbose log * Rebuilt URL to: https://curl.haxx.se/ * Trying 138.204.145.39... * TCP_NODELAY set * Connected to 138.204.145.39 (138.204.145.39) port 80 (#0) * Establish HTTP proxy tunnel to curl.haxx.se:443 > CONNECT curl.haxx.se:443 HTTP/1.1 Host: curl.haxx.se:443 Proxy-Connection: Keep-Alive * Recv failure: Connection was reset * Received HTTP code 0 from proxy after CONNECT * Curl_http_done: called premature == 0 * Closing connection 0 the example above is return empty page with out error in verbose log error Recv failure: Connection was reset now we will change url from https://curl.haxx.se/ to https://www.google.com/ it's will run normal and get google page with out any change in code only change url there are many sites not work in this way can any one help me to solve this issue thank you Edited August 18, 2017 by mrmax2000 Quote Link to comment Share on other sites More sharing options...
requinix Posted August 19, 2017 Share Posted August 19, 2017 You already got your answer: The point I'm trying to make is that the proxy doesn't respond with proper HTTP in this case and thus it is broken - it doesn't help us much that it works fine with other hosts. There's nothing curl can do about a proxy that disconnects without even giving an error code. This is a proxy issue and you should ask the proxy admins about it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.