0% found this document useful (0 votes)
6 views2 pages

Api_ Total Viruss

The document is a PHP script that uses cURL to query the VirusTotal API for information about a specified domain. It requires an API key for authentication and handles both cURL and HTTP errors. The response is printed in a readable format if the request is successful.

Uploaded by

Cojab Mia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Api_ Total Viruss

The document is a PHP script that uses cURL to query the VirusTotal API for information about a specified domain. It requires an API key for authentication and handles both cURL and HTTP errors. The response is printed in a readable format if the request is successful.

Uploaded by

Cojab Mia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

<?

php

$apiKey = 'TU_API_KEY_AQUI'; // Reemplaza esto con tu clave real

$domain = 'example.com';

$url = "https://www.virustotal.com/api/v3/domains/$domain";

// Inicia cURL

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_HTTPHEADER, [

"x-apikey: $apiKey"

]);

$response = curl_exec($ch);

// Manejo de errores

if (curl_errno($ch)) {

echo " Error cURL: " . curl_error($ch);

} else {

$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

if ($httpCode === 200) {

$data = json_decode($response, true);

echo "<pre>";

print_r($data);
echo "</pre>";

} else {

echo " Error HTTP: $httpCode\n";

echo "Respuesta: $response";

curl_close($ch);

You might also like