【发布时间】:2016-05-25 21:17:33
【问题描述】:
我有以下php函数:
function checkJQL($filter) {
$auth = "account:password";
$URL='http://jira/rest/api/latest/search?jql='.$filter;
echo $URL;
// Initiate curl
$ch = curl_init();
// Disable SSL verification
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
//Tell it to always go to the link
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
// Will return the response, if false it print the response
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Set the url
curl_setopt($ch, CURLOPT_URL,$URL);
//Set username and password
curl_setopt($ch, CURLOPT_USERPWD, $auth);
// Execute
$result=curl_exec($ch);
// Closing
curl_close($ch);
echo $result;
// Will dump a beauty json :3
var_dump(json_decode($result, true));
echo "DONE";
}
当我用$filter = "" 调用它时,它工作正常,输出所有内容。只要我插入正确的 JQL 查询,它就会失败。当我输入随机垃圾时,它可以工作(就像我收到无效的输入消息一样),但是当它是正确的 JQL 时它永远不会工作。
当我将回显的 URL 复制并粘贴到浏览器中时,它可以工作。 我使用的示例过滤器:
“目标”=“废话”
当我想到它时,我实际上并不需要它来工作,我只需要它知道输入何时不是 JQL(它确实如此)。但我现在真的很好奇。有人对它可能是什么有想法吗?
【问题讨论】:
标签: php curl jira jira-rest-api