gpt4 book ai didi

php - 在目标 URL 中使用感叹号 + 主题标签进行 curl

转载 作者:行者123 更新时间:2023-12-02 14:23:48 26 4
gpt4 key购买 nike

我正在尝试在目标 url 中使用主题标签进行简单的 curl - 但出现错误。

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

<?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: event not found

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

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

最佳答案

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

关于php - 在目标 URL 中使用感叹号 + 主题标签进行 curl ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17209710/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com