在目标网址中使用感叹号+主题标签卷曲

时间:2013-06-20 09:11:28

标签: php curl ssh nginx

我正在尝试使用目标网址中的主题标签进行简单的卷曲 - 但是会收到错误。

我知道这个剧本有效,我之前已多次使用过它。

<?php

error_reporting(E_ALL);

$curl = curl_init('http://tools.pingdom.com/fpt/#!/d3YvU8/http://www.nginx-hosting.co.uk');
curl_setopt($curl, CURLOPT_FAILONERROR, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);  
$result = curl_exec($curl);

if ($result == ("")) {
echo ("Nothing to curl");
}
else {
echo $result;
}

?> 

以上是上面的脚本:http://www.nginx-hosting.co.uk/curl_test.php

正如你所看到的那样,输出与它应该是完全不同的。我通过SSH运行相同的命令:

curl http://tools.pingdom.com/fpt/#!/d3YvU8/http://www.nginx-hosting.co.uk

但是收到此错误消息-bash:!/ d3YvU8 / http:找不到事件

我认为这是因为目标网址中有感叹号或标签。

请有人指出我正确的方向。提前致谢

1 个答案:

答案 0 :(得分:2)

我刚试过你的脚本它运行得很好,关于-bash: !/d3YvU8/http: event not found错误你应该使用引号如:curl' http://tools.pingdom.com/fpt/#!/d3YvU8/http://www.nginx-hosting.co.uk