1

I have find socks and check a socks live, and code below :

$url = 'http://example.com';
$ch = curl_init (); 
curl_setopt ($ch, CURLOPT_URL, $url); 
curl_setopt ($ch, CURLOPT_PROXY, "76.8.6.203:37639"); 
//curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); 
curl_setopt ($ch, CURLOPT_PROXYTYPE, 7);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, TRUE); 
curl_setopt ($ch, CURLOPT_FAILONERROR, true); 
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); 
$data = curl_exec($ch); 
curl_close ($ch); 

echo $data;

Although i use CURLOPT_PROXYTYPE is 7 or CURLPROXY_SOCKS5 then error 502! Thanks please help me!

user3129040
  • 167
  • 1
  • 3
  • 12
  • 2
    Possible duplicate of [How to use a SOCKS 5 proxy with cURL?](http://stackoverflow.com/questions/13444738/how-to-use-a-socks-5-proxy-with-curl) – Kevin Van Ryckegem Sep 12 '16 at 15:38
  • hi, i have do it but why error 502, plz help me! – user3129040 Sep 12 '16 at 16:45
  • 502 is a HTTP response code which implies that the proxy worked and you reached the HTTP server specified in the URL? You can also skip CURLOPT_PROXYTYPE and specify socks type with a scheme prefix to the proxy name. – Daniel Stenberg Sep 12 '16 at 18:35

0 Answers0