【发布时间】:2013-08-28 04:24:50
【问题描述】:
我使用这个代码:
$this->curl = curl_init();
curl_setopt($this->curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
curl_setopt($this->curl, CURLOPT_TIMEOUT, 60);
curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->curl, CURLOPT_PROXY, '127.0.0.1:9050');
curl_setopt($this->curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
curl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($this->curl, CURLOPT_URL, "http://some-onion-site.onion");
$contents = curl_exec($this->curl);
它会立即返回任何内容。 Tor 工作正常,可以从 Tor 浏览器访问网站。 编辑:我发现它无法解析主机(“无法解析主机名”错误)。
【问题讨论】:
-
使用
curl_error()看看出了什么问题 -
@Pekka웃 我已经编辑了这个问题。它无法解析主机名。