PHP code example of armd-pro / proxmox-api

1. Go to this page and download the library: Download armd-pro/proxmox-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

armd-pro / proxmox-api example snippets




try {

    $client = new \ProxmoxApi\ProxmoxClient('127.0.0.1:8006', 'root', 'password', 'pam');
    $node = $client->node('proxmox'/* Node name */);
    $vm = $node->vm(100/* VM id */);
    
    print_r($vm->get('status/current'));
    
    /*$vm->set("resize", [
        'disk' => $vm->config()->bootdisk,
        'size' => "+1G"
    ]);*/
    
    // print_r($client->get('nodes'));
    // print_r($node->get('disks/list'));
    // print_r($vm->config());

} catch(\ProxmoxApi\ProxmoxApiException $e) {
    exit("Error: {$e->getMessage()}\n");
}