usamember usamember - 3 months ago 15
PHP Question

Use PHP to deploy 20 minutes trial VPS powered by Scaleway

i just knew thats the http://instantcloud.io api link is https://try.cloud.online.net

and i want to provide free 20 minutes VPS to my site visitors to enjoy more , of course i will leave credits to the instantcloud.io becoz they are the hosters

can someone tell me some php examples to start building?

Answer

EDIT: to correct you, Instantcloud.io was giving 20 minutes trial in the past but now it's only 15 minutes.


Seems really simple.

Anyway, the Instantcloud.io API link is https://try.cloud.online.net/servers and not https://try.cloud.online.net .

And as a lot of APIs, the Instantcloud.io API return the data using JSON.

Currently, I get the following when I try to browse https://try.cloud.online.net/servers in the browser:

{
  "message": "No server available at the moment",
  "type": "unknown_resource"
}

And when I try to click "GET YOUR C2M SERVER" button in http://instantcloud.io/, I get

Oops!

All cloud servers are busy, please retry in few minutes :)

So, https://try.cloud.online.net/servers really return the correct answer!


Start by making the PHP part like that:

<?php
$instantcloud['api'] = "https://try.cloud.online.net/servers";
$instantcloud['jsonfalse'] = json_decode($instantcloud['api']);
if( $instantcloud['jsonfalse']->message == "No server available at the moment" ) {
    echo 'Failed creating server. Reason: no stocks available.';
    die();
}
?>

I really don't know how we can create the server AT THE MOMENT , because I get "No server available at the moment" and I don't know what the API will return if the server is created...

So wait until I'm able to create a server then I'll edit this answer!