WEB Service API

This is the documentation of AlternC v2 WEB api. Refer to AlternC v2 specs for more information.

function bool web_add_vhost(string $domain, integer $user,struct $vhostparam)

Create a virtual host for the domain $domain associated to the user account $user. $vhostparam is a structure that contain vhost parameters. At least a vhost type and its mandatory parameters are required.

struct $vhostparam = array(

"vhosttype" => "DIR" // A vhost type : plugins may add new vhost types with specific parameters.

// depending on the vhost type, there may be additionnal parameters as follow :

if vhosttype = "DIR" : The vhost will be directed to a user's subdirectory of its home.

"documentroot" => "mydomain/www/" // A folder relative to the user's home, where the domain will point to.

if vhosttype = "REDIRECT" : The vhost will be a permanent redirection to another URL

"urlredirect" => "http://www.example.com" // A url where the vhost wlil redirect all incoming clients

// Here is an example of vhosttype from a plugin :

if vhosttype = "SQUIRRELMAIL" : The vhost will point to the squirrelmail webmail. It has no specific parameters.

// vhost param may also contain :

"rawconfig" => "php_flag safe_mode off", // Any valid apache configuration directive can be placed here, separate them by \n "vhostalias" => "example.net" // This can be a string with one domain, or an array of domains : add a serveralias directive, that will tell which other domains will point to the same vhost. );

function bool web_del_vhost(string $domain)

Remove the virtual host and all of its configuration. Returns TRUE if the virtual host has been deleted, FALSE if it has not been deleted.