如何在SOCKS 5中使用CURL PHP

时间:2016-09-12 14:52:05

标签: php curl socks

我找到袜子并检查袜子,并在下面编码:

$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;

虽然我使用CURLOPT_PROXYTYPE是7或CURLPROXY_SOCKS5然后错误502!谢谢,请帮助我!

0 个答案:

没有答案