Ожидание завершения сканирования VirusTotal - PullRequest
0 голосов
/ 15 февраля 2019

Я использую следующий код для загрузки файла в Virustotal. Это работает нормально, но после того, как curl завершит загрузку, Virustotal отвечает «Ожидание анализа для завершения сообщения», и мне нужно еще раз пересмотреть URL, чтобы получить результаты.Как я могу ждать, чтобы получить результат от Virustotal?Пожалуйста, совет

$file_name_with_full_path = realpath("test_uploads/$fileName");
$api_key = getenv('VT_API_KEY') ? getenv('VT_API_KEY') :'mykey';
$cfile = curl_file_create($file_name_with_full_path);

$post = array('apikey' => $api_key,'file'=> $cfile);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.virustotal.com/vtapi/v2/file/scan');
curl_setopt($ch, CURLOPT_POST, True);
curl_setopt($ch, CURLOPT_VERBOSE, 1); // remove this if your not debugging
curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate'); // please compress data
curl_setopt($ch, CURLOPT_USERAGENT, "gzip, My php curl client");
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);
...