PHP code example of clue / solusvm-api-react

1. Go to this page and download the library: Download clue/solusvm-api-react 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/ */

    

clue / solusvm-api-react example snippets


$loop = React\EventLoop\Factory::create();
$factory = new Factory($loop);
$client = $factory->createClient(array(
    'user' => '147492ddec07231c2de7e5865880fd0191955916',
    'pass' => 'Y4WNA-TZS6J-15YMB',
    'host' => 'manage.myhost.local'
));

$client->info()->then(function ($result) {
    var_dump($result);
});

$loop->run();

$loop = React\EventLoop\Factory::create();
$factory = new Factory($loop);

$browser = new Clue\React\Buzz\Browser($loop);
$factory = new Factory($loop, $browser);

$client->reboot();
$client->boot();
$client->shutdown();

$client->status();
$client->info($ipaddr = true, $hdd = true, $mem = true, $bw = true);

$client->status()->then(
    function ($result) {
        // response received for status action
    },
    function (Exception $e) {
        // an error occured while executing the status action
    }
});