我现在已经问过我的主人很多次了,这是否站在他们这边,他们说不。cURL 中的一切都在工作/启用;但是,每当我尝试以下代码时,我永远无法返回连接或页面(我已经测试了许多不同的工作代理)。
<?php
//THIS IS A TEST
$ch = curl_init('http://www.google.com');
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/14.0.1');
curl_setopt($ch, CURLOPT_PROXY, '114.80.136.112:7780');
curl_setopt($ch, CURLOPT_TIMEOUT, 40);
curl_exec($ch);
echo curl_error($ch);
print_r(curl_getinfo($ch));
curl_close($ch);
?>
其他人可以为我测试这个功能,看看他们是否得到任何工作结果吗?
编辑:也尝试过
<?php
//THIS IS A TEST
$ch = curl_init('http://www.google.com');
$f = fopen('requests.txt', 'w');
curl_setopt_array($ch, array(
CURLOPT_PROXY => '114.80.136.112:7780',
CURLOPT_PROXYTYPE => CURLPROXY_HTTP,
CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/14.0.1',
CURLOPT_TIMEOUT => 40,
CURLOPT_VERBOSE => 1,
CURLOPT_STDERR => $f,
));
curl_exec($ch);
fclose($f);
echo curl_error($ch);
print_r(curl_getinfo($ch));
curl_close($ch);
?>
在results.txt中返回了这个
* About to connect() to proxy 114.80.136.112 port 7780 (#0)
* Trying 114.80.136.112...
* Timeout
* connect() timed out!
* Closing connection #0