1

I want to use VirusTotal as way that they wrote in their websites.

<?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);
?>

But I always return error as:

status = 0

I have been searching a lot and still found nothing!!!

I very appreciate if u help me out. tnx.

Amir32dm
  • 41
  • 5
  • Your code works fine for me as is. I get `status = 200` and an array response including `Scan request successfully queued, come back later for the report` – Jeff Puckett Nov 13 '16 at 17:28
  • If I had to guess, then I'd say you [didn't have the curl extension installed](http://stackoverflow.com/a/6382581/4233593) and you're not [checking for errors](http://stackoverflow.com/q/845021/4233593). – Jeff Puckett Nov 13 '16 at 17:30
  • @JeffPuckettII tnx alot dear friend for your help. – Amir32dm Nov 13 '16 at 18:14

1 Answers1

1

I have figured out what was the problem. This is because thier website banned my country(Iran) IPs. I wasted my time from morning to noon to found this out :( :(

I should search for something else like this.

Amir32dm
  • 41
  • 5