2014-03-25 78 views
0

我有一个URL,如果我在我的浏览器中打开它的作品,我会得到预期的结果。curl php奇怪的行为

当我试图让我的服务器上通过PHP卷曲的内容,我得到的代码7错误(无法连接到主机)

同样的脚本工作我的本地机器上

这是我正在使用的代码:

$url = "http://test.com"; 
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $url); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
$data = curl_exec($ch); 

它与标头有关吗?或者它与php conf有关?

+2

你的浏览器使用代理。 –

回答