我正在尝试使用 rest api 在 QC 中打开一个新缺陷
我的代码如下所示
createxml ='<Entity Type="defect">
<Fields>
<Field Name="user-15">
<Value>Development</Value>
</Field>' ;
$qc = curl_init();
// create a cookie file
$ckfile = tempnam ("/tmp", "CURLCOOKIE");
// The authentication is done and also checks are done and after below code is executed to create a new defect in QC
$url ="http://host/qcbin/rest/domains/STANDARD_STRUCT/projects/Releases/defects/" ;
curl_setopt($qc, CURLOPT_COOKIEFILE, $ckfile);
curl_setopt($qc, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml"));
curl_setopt($qc, CURLOPT_HTTPHEADER, Array("Accept: application/xml"));
curl_setopt($qc, CURLOPT_URL, $url);
curl_setopt($qc, CURLOPT_POST, 1);
curl_setopt($qc, CURLOPT_POSTFIELDS,$createxml);
curl_setopt($qc, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($qc);
if(curl_errno($qc))
print curl_error($qc) ;
else
curl_close($qc) ;
echo $result ; `
注意:使用未定义的常量 http_code - 在第 150 200 行的 C:\xampp\htdocs\createdef.php 中假定为“http_code”,未创建响应`
我无法弄清楚是什么导致了这个问题。