Example #1
0
$user->country = 'nl';
$user->phoneNumber = '0383783388';
$user->faxNumber = '';
$user->email = '*****@*****.**';
$users[] = $user;
$result = true;
try {
    // Request the availability of a domain by using the Transip_DomainService API;
    // we can get the following different statusses back with different meanings.
    $availability = Transip_DomainService::checkAvailability($domain);
    switch ($availability) {
        case Transip_DomainService::AVAILABILITY_FREE:
            echo htmlspecialchars($domain) . ' is vrij voor registratie.<hr/>';
            try {
                $register = new Transip_Domain($domain, $nameservers, $users);
                Transip_DomainService::register($register);
            } 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: ' . htmlspecialchars($f->getMessage());
                $result = false;
            }
            break;
        default:
            echo htmlspecialchars($domain) . ' is niet beschikbaar. Registratie afgebroken.';
            $result = false;
            break;
    }
} 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.
<?php

/**
 * This example registers a domain with custom nameservers.
 *
 * @copyright Copyright 2011 TransIP BV
 * @author TransIP BV <*****@*****.**>
 */
// Include domainservice
require_once 'Transip/DomainService.php';
try {
    // obviously, there are several DNS entry types. these are defined in
    // the class constants for ease of use
    $dnsEntries[] = new Transip_DnsEntry('@', 86400, Transip_DnsEntry::TYPE_A, '80.69.67.46');
    $dnsEntries[] = new Transip_DnsEntry('@', 86400, Transip_DnsEntry::TYPE_MX, '10 @');
    $dnsEntries[] = new Transip_DnsEntry('@', 86400, Transip_DnsEntry::TYPE_MX, '20 relay.transip.nl.');
    $dnsEntries[] = new Transip_DnsEntry('ftp', 86400, Transip_DnsEntry::TYPE_CNAME, '@');
    $dnsEntries[] = new Transip_DnsEntry('mail', 86400, Transip_DnsEntry::TYPE_CNAME, '@');
    $dnsEntries[] = new Transip_DnsEntry('www', 86400, Transip_DnsEntry::TYPE_CNAME, '@');
    // you can now use the $dnsEntries array as the fourth parameter when instantiating
    // a new Transip_Domain. For example:
    $domain = new Transip_Domain('example.com', $nameservers = null, $contacts = null, $dnsEntries);
    Transip_DomainService::register($domain);
    echo 'The domain ' . $domain->name . ' has been requested.';
} 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;
}
Example #3
0
/**
 *
 *
 * @param array   $params
 *
 * @return array
 */
function transip_RegisterDomain($params)
{
    transip_initialize($params);
    $domain = new Transip_Domain($params['sld'] . "." . $params['tld']);
    $domain->nameservers = array();
    foreach ($params as $key => $value) {
        if (preg_match("/^ns([0-9]+)\$/", $key, $matches) && !empty($value)) {
            $domain->nameservers[$matches[1] - 1] = new Transip_Nameserver($value);
            continue;
        }
    }
    $domain->contacts = transip_getContactsForRegisterAndTransfer($params);
    logModuleCall("transip", "RegisterDomain", $domain, null);
    Transip_DomainService::register($domain);
    return array();
}