/**
  * Gets the singleton SoapClient which is used to connect to the TransIP Api.
  *
  * @param  mixed       $parameters  Parameters.
  * @return SoapClient               The SoapClient object to which we can connect to the TransIP API
  */
 public static function _getSoapClient($parameters = array())
 {
     $endpoint = Transip_ApiSettings::$endpoint;
     if (self::$_soapClient === null) {
         $extensions = get_loaded_extensions();
         $errors = array();
         if (!class_exists('SoapClient') || !in_array('soap', $extensions)) {
             $errors[] = 'The PHP SOAP extension doesn\'t seem to be installed. You need to install the PHP SOAP extension. (See: http://www.php.net/manual/en/book.soap.php)';
         }
         if (!in_array('openssl', $extensions)) {
             $errors[] = 'The PHP OpenSSL extension doesn\'t seem to be installed. You need to install PHP with the OpenSSL extension. (See: http://www.php.net/manual/en/book.openssl.php)';
         }
         if (!empty($errors)) {
             die('<p>' . implode("</p>\n<p>", $errors) . '</p>');
         }
         $classMap = array('WebhostingPackage' => 'Transip_WebhostingPackage', 'WebHost' => 'Transip_WebHost', 'Cronjob' => 'Transip_Cronjob', 'MailBox' => 'Transip_MailBox', 'Db' => 'Transip_Db', 'MailForward' => 'Transip_MailForward', 'SubDomain' => 'Transip_SubDomain');
         $options = array('classmap' => $classMap, 'encoding' => 'utf-8', 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, 'trace' => false);
         $wsdlUri = "https://{$endpoint}/wsdl/?service=" . self::SERVICE;
         try {
             self::$_soapClient = new SoapClient($wsdlUri, $options);
         } catch (SoapFault $sf) {
             throw new Exception("Unable to connect to endpoint '{$endpoint}'");
         }
         self::$_soapClient->__setCookie('login', Transip_ApiSettings::$login);
         self::$_soapClient->__setCookie('mode', Transip_ApiSettings::$mode);
     }
     $timestamp = time();
     $nonce = uniqid('', true);
     self::$_soapClient->__setCookie('timestamp', $timestamp);
     self::$_soapClient->__setCookie('nonce', $nonce);
     self::$_soapClient->__setCookie('clientVersion', self::API_VERSION);
     self::$_soapClient->__setCookie('signature', self::_urlencode(self::_sign(array_merge($parameters, array('__service' => self::SERVICE, '__hostname' => $endpoint, '__timestamp' => $timestamp, '__nonce' => $nonce)))));
     return self::$_soapClient;
 }
<?php

/**
 * This example gets information about a webhosting package.
 *
 * @copyright Copyright 2011 TransIP BV
 * @author TransIP BV <*****@*****.**>
 */
require_once 'Transip/WebhostingService.php';
if (isset($_GET['domain']) && strlen($_GET['domain']) > 0) {
    $domainName = $_GET['domain'];
    try {
        // Request information about a domain in your account by using the TransIP
        // WebhostingService API; A WebHost Object will be returned holding all
        // information available about the domain.
        $domain = Transip_WebhostingService::getInfo($domainName);
        // INFO: A WebHost object holds all data directly available for a domain:
        //		 + it has a list of MailBoxes,
        //		 + a list of Cronjobs
        //		 + a list of Dbs
        //		 + a list of MailForwards
        //		 + a list of subDomains
        //
        $result = 'We got the following information about the domain ' . htmlspecialchars($domainName) . ':';
    } catch (SoapFault $e) {
        // It is possible that an error occurs when connecting to the TransIP Soap API,
        // those errors will be thrown as a SoapFault exception.
        $result = 'An error occurred: ' . htmlspecialchars($e->getMessage());
    }
} else {
    $domainName = '';
<?php

/**
 * This example creates a mailbox for a webhosting package.
 *
 * @copyright Copyright 2011 TransIP BV
 * @author TransIP BV <*****@*****.**>
 */
// Include webhostingservice
require_once 'Transip/WebhostingService.php';
try {
    // Create a MailBox for a webhosting package.
    // with default settings
    // It's also possible to create a mailbox with custom settings,
    // for this the MailBox should be created with:
    // $mailBox = new Transip_MailBox('info', <spamCheckerStrength (LOW,AVERAGE,HIGH)>, <maxDiskUsage in MB>)
    $mailBox = new Transip_MailBox('info');
    Transip_WebhostingService::createMailBox('example.com', $mailBox);
} catch (SoapFault $f) {
    // It is possible that an error occurs when connecting to the TransIP Soap API,
    // those errors will be thrown as a SoapFault exception.
    echo 'An error occurred: ' . $f->getMessage(), PHP_EOL;
}
<?php

/**
 * This example fetches all domain names which have a webhosting package enabled.
 *
 * @copyright Copyright 2011 TransIP BV
 * @author TransIP BV <*****@*****.**>
 */
// Include webhosting service
require_once 'Transip/WebhostingService.php';
// Set the result variable
$webhostingList = array();
try {
    // Call the API, the result will be an array of all your webhosting names
    $webhostingList = Transip_WebhostingService::getWebhostingDomainNames();
    // Output the webhosting names
    print_r($webhostingList);
} catch (SoapFault $e) {
    // It is possible that an error occurs when connecting to the TransIP Soap API,
    // those errors will be thrown as a SoapFault exception.
    echo 'An error occurred: ' . $e->getMessage(), PHP_EOL;
}