用一個(gè)socket5的代理訪問(wèn)谷歌,命令行模式下可以的,但是PHP代碼就是不行,直接返回false
代碼貼出來(lái)了,求大神幫我捋捋吧
ringa_lee
代理字符串寫(xiě)成 tcp://127.0.0.1:1080
試試,
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
if ($this->proxy) {
curl_setopt($ch, CURLOPT_PROXY, $this->proxy);
}
上面是我弄google的時(shí)候的配置,正常用。