You should include a set of PHP classes to invoke methods of the integration API in your application. To do it, click the PHP classes link, copy the PHP code and paste it into the code of the application.
Note: The classes should be declared before invoking integration API methods.
For details on the set of classes, refer to the PHP Classes Details section.
To add a host to Plesk Sitebuilder hosts pool, the following steps should be taken:
1. Specify preferences common for all Plesk Sitebuilder web services.
The preferences are as follows:
$serviceUrl = 'http://example.com/ServiceFacade/4.5/';
$serviceLogin = 'serviceLogin';
$servicePassword = 'servicePassword';
2. Create an instance of the SOAP client that invokes methods of web service HostWebService.
$hostService = new Utils_SoapClient($serviceUrl.'/HostWebService.asmx?WSDL', array());
3. Create an instance of standard PHP class stdClass and specify the host properties.
A sample of host properties can look as follows:
$struct = new stdClass();
$struct->hostName = 'myNewHost';
$struct->hostAddress = 'example.com';
$struct->SMTPPort = 0;
4. Invoke method CreateHost.
$result = $hostService->CreateHost(new SoapVar($struct, SOAP_ENC_OBJECT));
After the host is created, you can retrieve preferences of the host. For instance, you can retrieve the host ID. The PHP code of the operation looks as follows:
$hostId = $result->CreateHostResult->Id;
For full PHP code sample, click on the following link: code sample.