Hello,

I need help with solusVM Client:API...

I have got the example php script from their website but it doesn't seem to work. After all the tests, i think its bcz of the port 5656 but still i would like to know who has got it work.

Here's the example php script:
PHP Code: 
<?php
 
// Url to the client API
 
$url "https://<MASTER IP>:5656/api/client";
 
// Specify the key, hash and action
 
$postfields["key"] = "EXAMPLE-API-KEY";
$postfields["hash"] = "exaMpleHasH";
$postfields["action"] = "reboot"// reboot, shutdown, boot, status
 
// Send the query to the solusvm master
 
$ch curl_init();
curl_setopt($chCURLOPT_URL$url "/command.php");
curl_setopt($chCURLOPT_POST1);
curl_setopt($chCURLOPT_TIMEOUT20);
curl_setopt($chCURLOPT_FRESH_CONNECT1);
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
curl_setopt($chCURLOPT_SSL_VERIFYHOSTfalse);
curl_setopt($chCURLOPT_HEADER0);
curl_setopt($chCURLOPT_RETURNTRANSFER1);
curl_setopt($chCURLOPT_POSTFIELDS$postfields);
$data curl_exec($ch);
curl_close($ch);
 
// Parse the returned data and build an array
 
preg_match_all('/<(.*?)>([^<]+)<\/\\1>/i'$data$match);
$result = array();
foreach (
$match[1] as $x => $y)
{
    
$result[$y] = $match[2][$x];
}
 
?>

<?php
 
print_r
($result);
 
?>

<?php
 
// Check for any errors
 
if ($result["status"] == "error")
{
    echo 
$result["statusmsg"];
    exit();
}
 
// Display a message on a successful return
 
if ($result["status"] == "success")
{
    if (
$result["statusmsg"] == "online")
    {
        echo 
"The virtual server is online!";
    } elseif (
$result["statusmsg"] == "offline")
    {
        echo 
"The virtual server is offline!";
    } elseif (
$result["statusmsg"] == "rebooted")
    {
        echo 
"The virtual server has been rebooted!";
    } elseif (
$result["statusmsg"] == "shutdown")
    {
        echo 
"The virtual server has been shutdown!";
    } elseif (
$result["statusmsg"] == "booted")
    {
        echo 
"The virtual server has been booted!";
    }
    else
    {
        echo 
"Status message unknown!";
    }
}
 
?>
Thanks
-PALOOO
Palooo 2009 Reviewed by Palooo 2009 on . Help with SolusVM Client:API... Hello, I need help with solusVM Client:API... I have got the example php script from their website but it doesn't seem to work. After all the tests, i think its bcz of the port 5656 but still i would like to know who has got it work. Here's the example php script: <?php // Url to the client API Rating: 5