<?php

function balance() {
    $url = 'https://4vps.su/api/userBalance';

    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Content-Type: application/json',
        'Authorization: Bearer xpttm0nkXsKKc4sthpeFazTha'
    ));

    $response = curl_exec($ch);
    curl_close($ch);

    return $response;
}function list_server() {
    $url = 'https://4vps.su/api/myservers';

    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Content-Type: application/json',
        'Authorization: Bearer xpttm0nkXsKKc4sthpeFazTha'
    ));

    $response = curl_exec($ch);
    curl_close($ch);

    return $response;
}function create() {
    $url = 'https://4vps.su/api/action/buyServer';
    $data['post_data']['name']       = 'name-4208424';
    $data['post_data']['datacenter'] = '5';
    $data['post_data']['tarif']      = '15';
    $data['post_data']['ostempl']    = '13';
    $data['post_data']['period']    = '2160';
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data['post_data']));
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Authorization: Bearer xpttm0nkXsKKc4sthpeFazTha'
    ));

    $response = curl_exec($ch);
    curl_close($ch);

    return $response;
}
function os() {
    $url = 'https://4vps.su/api/action/shutdown';
    $data['post_data']['serverid']       = '67305';
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data['post_data']));
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Authorization: Bearer xpttm0nkXsKKc4sthpeFazTha'
    ));

    $response = curl_exec($ch);
    curl_close($ch);

    return $response;
}

echo os();