我正在嘗試使用Qualys API v2來獲取返回的xml主機列表。我認爲你必須使用cURL,但我不熟悉它。這裏是我的代碼:如何在PHP中使用Qualys API v2?
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_URL, "https://qualysapi.qualys.com/api/2.0/fo/asset/host/?action=list&details=Basic");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-Requested-With: Manitowoc Service Account'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$xml = curl_exec($ch);
curl_close();
$hostobj = simplexml_load_string($xml);
什麼問題?你有什麼錯誤嗎? – drew010 2012-07-23 21:21:15