首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >目标URL中带感叹号+ hasthag的卷曲

目标URL中带感叹号+ hasthag的卷曲
EN

Stack Overflow用户
提问于 2013-06-20 17:11:28
回答 1查看 1.9K关注 0票数 1

我试着在目标url中添加一个标签来做一个简单的curl --但是得到了错误。

我知道这个脚本很有效,我以前已经用过很多次了。

代码语言:javascript
复制
<?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运行了相同的命令:

代码语言:javascript
复制
curl http://tools.pingdom.com/fpt/#!/d3YvU8/http://www.nginx-hosting.co.uk

但会收到此错误消息-bash:!/d3YvU8/http: event not found

我认为这是因为目标url中有一个感叹号或hashtag。

有人能告诉我怎么走吗?提前感谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-06-20 17:14:33

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

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17209710

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档