tags:

views:

37

answers:

2

Does anybody have a PHP example of using the VirusTotal.com public API for URL scanning?

The API is available here: http://www.virustotal.com/advanced.html

There's a Python/JSON example, but I'm not experienced with either :(

+1  A: 

All you need is to retreive the report json using file_get_contents this way :

$json = file_get_contents('https://www.virustotal.com/api/get_url_report.json');

Then use json_decode to convert your json into a php array:

$array = json_decode($json);

to see results :

var_dump($array);

to post data use curl, related question.

youssef azari
You can't make POST requests like this. Without the needed parameters, the site just returns `None`.
svens
@svens, are you talking about posting data via CURL ?
youssef azari
More is needed than that. Please see the sections "Retrieve a URL scan report" and "Submit and scan a URL" under Public API on http://www.virustotal.com/advanced.html.
JubbaJubba
All is about sending parameters using POST, a good tutorial : http://www.askapache.com/htaccess/sending-post-form-data-with-php-curl.html
youssef azari
A: 

A PHP example is available on that page (maybe it's new).

Peter