<?php
$start_time = microtime(true);
include '../database.php';

$request = file_get_contents("https://sc2.afzoneh-nevis.com/test/cloudsnap/API_randtests/api.php?list_all&api_token=$api_key");
$response = json_decode($request, true);

$request13 = file_get_contents("https://sc2.afzoneh-nevis.com/test/cloudsnap/API_randtests/api.php?list_ipv4&api_token=$api_key");
$response13 = json_decode($request13, true);

$request14 = file_get_contents("https://sc2.afzoneh-nevis.com/test/cloudsnap/API_randtests/api.php?list_ipv4&api_token=$api_key_hetzner");
$response14 = json_decode($request14, true);

$request6 = file_get_contents("https://sc2.afzoneh-nevis.com/test/cloudsnap/API_randtests/api.php?float_list&api_token=$api_key");
$response6 = json_decode($request6, true);

$request44 = file_get_contents("https://sc2.afzoneh-nevis.com/test/cloudsnap/API_randtests/api.php?list_snapshot&api_token=$api_key");
$response44 = json_decode($request44, true);

$request7 = file_get_contents("https://sc2.afzoneh-nevis.com/test/cloudsnap/API_randtests/api.php?float_list&api_token=$api_key_hetzner");
$response7 = json_decode($request7, true);

$request55 = file_get_contents("https://sc2.afzoneh-nevis.com/test/cloudsnap/API_randtests/api.php?list_snapshot&api_token=$api_key_hetzner");
$response55 = json_decode($request55, true);

$request8 = file_get_contents("https://sc2.afzoneh-nevis.com/test/cloudsnap/API_randtests/api.php?list_all&api_token=$api_key_hetzner");
$response8 = json_decode($request8, true);

$request1 = file_get_contents("https://sc2.afzoneh-nevis.com/test/cloudsnap/API_randtests/api.php?list_all&api_token=kPalXsQG6EpQe1MvSe2TxNUfUkv9hsDuTi6XfbbpFj6PpkQ5Fin0nH9mTzIQdHZ5");
$response1 = json_decode($request1, true);

$request2 = file_get_contents("https://sc2.afzoneh-nevis.com/test/cloudsnap/API_randtests/linode.php?list");
$response2 = json_decode($request2, true);

$request3 = file_get_contents("https://sc2.afzoneh-nevis.com/test/cloudsnap/API_randtests/vultr.php?list");
$response3 = json_decode($request3, true);

include_once '/www/wwwroot/sc2.afzoneh-nevis.com/test/cloudsnap/API_randtests/virtua.php';
$virtuaClient = new virtua();
$responseVirtua = json_decode($virtuaClient->list_server(), true);

$ovhlist = file_get_contents('https://sc2.afzoneh-nevis.com/test/cloudsnap/API_randtests/ovh.php?list_server');
$responseOVH = json_decode($ovhlist, true);

$request4 = file_get_contents("https://sc2.afzoneh-nevis.com/test/cloudsnap/API_randtests/linode.php?list&api=$api_key_linode");
$response4 = json_decode($request4, true);

$request5 = file_get_contents("https://sc2.afzoneh-nevis.com/test/cloudsnap/API_randtests/vultr.php?list&api=$api_key_vultr");
$response5 = json_decode($request5, true);

$request16 = file_get_contents("https://sc2.afzoneh-nevis.com/test/cloudsnap/API_randtests/gcore.php?list&reg=116");
$response16 = json_decode($request16, true);

$request17 = file_get_contents("https://sc2.afzoneh-nevis.com/test/cloudsnap/API_randtests/gcore.php?list&reg=38");
$response17 = json_decode($request17, true);

$request18 = file_get_contents("https://sc2.afzoneh-nevis.com/test/cloudsnap/API_randtests/gcore.php?list&reg=104");
$response18 = json_decode($request18, true);

$data = [
    'hetzner' => $response,
    'hetzner2' => $response1,
    'hetzner3' => $response8,
    'linode' => $response2,
    'linode2' => $response4,
    'vultr' => $response3,
    'vultr2' => $response5,
    'virtua' => $responseVirtua,
    'ovh' => $responseOVH,
    'hetzner_float' => $response6,
    'hetzner_float2' => $response7,
    'hetzner_snap' => $response44,
    'hetzner_snap2' => $response55,
    'list_ipv4' => $response13,
    'list_ipv42' => $response14,
    'gcore1' => $response16,
    'gcore2' => $response17,
    'gcore3' => $response18
];

file_put_contents('list_server.json', json_encode($data, JSON_PRETTY_PRINT));
$end_time = microtime(true);

$execution_time = $end_time - $start_time;

echo $execution_time;