I want to use proxy IP through socks5 to request whether the web page is successful or not.
here is the code I tried. I also tried to change CURLPROXY_SOCKS5 to 5 and 7, but always got the following error:
- string (40) "No authentication method was acceptable."
- bool (false)
try using curl-- socks5 IP:port-U user:psw" http://..." also reported the same error
$targetUrl = "http://1.1.1.1/getip?token=".TOKEN."&id=".NETID;
$proxyServer = "X.X.X.X:60011";
$proxyAuth = USER.":".PSW;
$proxy1 = $proxyAuth."@".$proxyServer;
$proxy2 = "socks5://".$proxyAuth."@".$proxyServer;
$proxy3 = "socks5://".$proxyServer;
$curl = curl_init();
//curl_setopt($curl, CURLOPT_URL, $targetUrl);
//curl_setopt($curl, CURLOPT_HEADER, 1);
//curl_setopt($curl, CURLOPT_PROXY, "socks5://".$proxyAuth."@".$proxyServer);
//curl_setopt($curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
//curl_setopt($curl, CURLOPT_PROXYTYPE, 7);
//curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_URL,$targetUrl);
curl_setopt($curl, CURLOPT_PROXY, $proxy3);
curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyAuth);
curl_setopt($curl, CURLOPT_PROXYTYPE, 5);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($curl);
$err = curl_error($curl);
dump($data);
dump($err);
- Please take a look at it. Thank you