0
我想使用VirusTotal作爲他們在他們的網站中編寫的方式。VirusTotal API(php)總是返回0
<?php
$virustotal_api_key = '9491e275f708f55b0777b495411556c916afdda7255d4614500d4aed27175001';
$scan_url = 'https://www.google.com/';
$post = array('apikey' => $virustotal_api_key,'url'=> $scan_url);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.virustotal.com/vtapi/v2/url/scan');
curl_setopt($ch, CURLOPT_POST, True);
curl_setopt($ch, CURLOPT_VERBOSE, 1); // remove this if your not debugging
curl_setopt($ch, CURLOPT_RETURNTRANSFER ,True);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$result=curl_exec ($ch);
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
print("status = $status_code\n");
if ($status_code == 200) { // OK
$js = json_decode($result, true);
print_r($js);
} else { // Error occured
print($result);
}
curl_close ($ch);
?>
但我始終返回錯誤爲:
狀態= 0
我一直在尋找了很多,仍然一無所獲!
我非常感謝,如果你幫我。 tnx。
您的代碼工作正常,我的是,我得到'狀態= 200'和一個數組響應,包括'掃描請求成功排隊,稍後回來報告' –
如果我不得不猜測,那麼我會說你[沒有安裝curl擴展](http://stackoverflow.com/a/6382581/4233593)並且你沒有[檢查錯誤](http://stackoverflow.com/q/845021/4233593)。 –
@JeffPuckettII tnx很多親愛的朋友爲你提供幫助。 – Amir32dm