From f79f0bdba350cbe523badf593efdf15cfe63f579 Mon Sep 17 00:00:00 2001
From: Sem Schilder
Date: Mon, 6 May 2019 10:33:13 +0200
Subject: [PATCH] Add version 5.13
---
CHANGELOG | 115 +++
Transip/ApiSettings.php | 43 ++
Transip/AvailabilityZone.php | 34 +
Transip/ColocationService.php | 305 ++++++++
Transip/Cronjob.php | 102 +++
Transip/DataCenterVisitor.php | 42 ++
Transip/Db.php | 49 ++
Transip/DnsEntry.php | 70 ++
Transip/DnsSecEntry.php | 86 +++
Transip/DnsService.php | 247 ++++++
Transip/Domain.php | 105 +++
Transip/DomainAction.php | 35 +
Transip/DomainBranding.php | 62 ++
Transip/DomainCheckResult.php | 45 ++
Transip/DomainService.php | 528 +++++++++++++
Transip/Forward.php | 101 +++
Transip/ForwardService.php | 240 ++++++
Transip/Haip.php | 140 ++++
Transip/HaipService.php | 539 ++++++++++++++
Transip/MailBox.php | 80 ++
Transip/MailForward.php | 39 +
Transip/Nameserver.php | 50 ++
Transip/OperatingSystem.php | 41 +
Transip/PrivateNetwork.php | 20 +
Transip/Product.php | 41 +
Transip/PropositionService.php | 194 +++++
Transip/Snapshot.php | 41 +
Transip/SubDomain.php | 30 +
Transip/Tld.php | 70 ++
Transip/Vps.php | 125 ++++
Transip/VpsBackup.php | 48 ++
Transip/VpsService.php | 702 ++++++++++++++++++
Transip/WebHost.php | 60 ++
Transip/WebhostingPackage.php | 41 +
Transip/WebhostingService.php | 474 ++++++++++++
Transip/WhoisContact.php | 403 ++++++++++
.../ColocationService-createIpAddress.php | 23 +
.../ColocationService-deleteIpAddress.php | 22 +
.../ColocationService-getColoOverview.php | 54 ++
examples/ColocationService-requestAccess.php | 114 +++
.../ColocationService-requestRemoteHands.php | 96 +++
examples/ColocationService-setReverseDns.php | 22 +
examples/DnsService-getDnsSecEntries.php | 23 +
examples/DnsService-setDnsEntries.php | 30 +
examples/DnsService-setDnsSecEntries.php | 49 ++
.../DomainService-batchCheckAvailability.php | 82 ++
examples/DomainService-batchGetInfo.php | 138 ++++
examples/DomainService-cancel.php | 57 ++
examples/DomainService-checkAvailability.php | 75 ++
examples/DomainService-domainActions.php | 67 ++
examples/DomainService-getAllTldInfos.php | 30 +
examples/DomainService-getAuthCode.php | 62 ++
examples/DomainService-getDomainNames.php | 32 +
examples/DomainService-getInfo.php | 130 ++++
examples/DomainService-getWhois.php | 51 ++
examples/DomainService-register-dns.php | 37 +
.../DomainService-register-nameserver.php | 43 ++
examples/DomainService-register-whois.php | 59 ++
examples/DomainService-register.php | 24 +
examples/DomainService-setContacts.php | 255 +++++++
examples/DomainService-setLock.php | 85 +++
examples/DomainService-setNameservers.php | 33 +
examples/DomainService-setOwner.php | 185 +++++
examples/DomainService-transfer.php | 57 ++
examples/ForwardService-order.php | 30 +
examples/HaipService-addCertificateToHaip.php | 20 +
.../HaipService-addHaipPortConfiguration.php | 24 +
examples/HaipService-addPortConfiguration.php | 23 +
examples/HaipService-cancelHaip.php | 23 +
examples/HaipService-changeHaipVps.php | 20 +
.../HaipService-deleteCertificateFromHaip.php | 21 +
...aipService-deleteHaipPortConfiguration.php | 24 +
.../HaipService-deletePortConfiguration.php | 22 +
...Service-getAvailableCertificatesByHaip.php | 22 +
.../HaipService-getCertificatesByHaip.php | 22 +
examples/HaipService-getHaip.php | 22 +
.../HaipService-getHaipPortConfigurations.php | 24 +
examples/HaipService-getHaips.php | 22 +
.../HaipService-getPortConfigurations.php | 22 +
examples/HaipService-getPtrForHaip.php | 22 +
examples/HaipService-getStatusReport.php | 20 +
examples/HaipService-setBalancingMode.php | 31 +
...aipService-setDefaultPortConfiguration.php | 21 +
examples/HaipService-setHaipDescription.php | 22 +
examples/HaipService-setHaipVpses.php | 20 +
examples/HaipService-setHttpHealthCheck.php | 20 +
examples/HaipService-setIpSetup.php | 31 +
examples/HaipService-setPtrForHaip.php | 21 +
examples/HaipService-setTcpHealthCheck.php | 20 +
...e-startHaipLetsEncryptCertificateIssue.php | 21 +
...aipService-updateHaipPortConfiguration.php | 26 +
.../HaipService-updatePortConfiguration.php | 24 +
...ropositionService-getPropositionStatus.php | 21 +
examples/VpsService-addIpv6ToVps.php | 21 +
.../VpsService-addVpsToPrivateNetwork.php | 21 +
examples/VpsService-cancelAddon.php | 22 +
examples/VpsService-cancelPrivateNetwork.php | 22 +
examples/VpsService-cancelVps.php | 22 +
examples/VpsService-cloneVps.php | 24 +
examples/VpsService-createSnapshot.php | 21 +
examples/VpsService-getActiveAddonsForVps.php | 22 +
examples/VpsService-getAllIps.php | 22 +
examples/VpsService-getAllPrivateNetworks.php | 22 +
examples/VpsService-getAvailabilityZones.php | 22 +
examples/VpsService-getAvailableAddons.php | 22 +
.../VpsService-getAvailableAddonsForVps.php | 22 +
examples/VpsService-getAvailableProducts.php | 22 +
examples/VpsService-getAvailableUpgrades.php | 22 +
.../VpsService-getCancellableAddonsForVps.php | 22 +
examples/VpsService-getIpsForVps.php | 25 +
examples/VpsService-getOperatingSystems.php | 22 +
...VpsService-getPooledTrafficInformation.php | 33 +
.../VpsService-getPrivateNetworksByVps.php | 22 +
examples/VpsService-getSnapshotsByVps.php | 22 +
...VpsService-getTrafficInformationForVps.php | 33 +
examples/VpsService-getVps.php | 22 +
examples/VpsService-getVpsBackupsByVps.php | 22 +
examples/VpsService-getVpses.php | 22 +
examples/VpsService-handoverVps.php | 23 +
.../VpsService-installOperatingSystem.php | 22 +
...rvice-installOperatingSystemUnattended.php | 53 ++
examples/VpsService-orderAddon.php | 23 +
examples/VpsService-orderPrivateNetwork.php | 20 +
examples/VpsService-orderVps.php | 25 +
examples/VpsService-removeSnapshot.php | 24 +
...VpsService-removeVpsFromPrivateNetwork.php | 24 +
examples/VpsService-reset.php | 24 +
examples/VpsService-revertSnapshot.php | 24 +
.../VpsService-revertSnapshotToOtherVps.php | 24 +
examples/VpsService-revertVpsBackup.php | 24 +
examples/VpsService-setCustomerLock.php | 26 +
examples/VpsService-start.php | 24 +
examples/VpsService-stop.php | 24 +
examples/VpsService-updatePtrRecord.php | 24 +
examples/VpsService-upgradeVps.php | 23 +
examples/WebhostingService-createMailBox.php | 28 +
examples/WebhostingService-getInfo.php | 178 +++++
...ostingService-getWebhostingDomainNames.php | 31 +
.../WebhostingService-order_and_upgrade.php | 37 +
139 files changed, 9222 insertions(+)
create mode 100644 CHANGELOG
create mode 100644 Transip/ApiSettings.php
create mode 100644 Transip/AvailabilityZone.php
create mode 100644 Transip/ColocationService.php
create mode 100644 Transip/Cronjob.php
create mode 100644 Transip/DataCenterVisitor.php
create mode 100644 Transip/Db.php
create mode 100644 Transip/DnsEntry.php
create mode 100644 Transip/DnsSecEntry.php
create mode 100644 Transip/DnsService.php
create mode 100644 Transip/Domain.php
create mode 100644 Transip/DomainAction.php
create mode 100644 Transip/DomainBranding.php
create mode 100644 Transip/DomainCheckResult.php
create mode 100644 Transip/DomainService.php
create mode 100644 Transip/Forward.php
create mode 100644 Transip/ForwardService.php
create mode 100644 Transip/Haip.php
create mode 100644 Transip/HaipService.php
create mode 100644 Transip/MailBox.php
create mode 100644 Transip/MailForward.php
create mode 100644 Transip/Nameserver.php
create mode 100644 Transip/OperatingSystem.php
create mode 100644 Transip/PrivateNetwork.php
create mode 100644 Transip/Product.php
create mode 100644 Transip/PropositionService.php
create mode 100644 Transip/Snapshot.php
create mode 100644 Transip/SubDomain.php
create mode 100644 Transip/Tld.php
create mode 100644 Transip/Vps.php
create mode 100644 Transip/VpsBackup.php
create mode 100644 Transip/VpsService.php
create mode 100644 Transip/WebHost.php
create mode 100644 Transip/WebhostingPackage.php
create mode 100644 Transip/WebhostingService.php
create mode 100644 Transip/WhoisContact.php
create mode 100644 examples/ColocationService-createIpAddress.php
create mode 100644 examples/ColocationService-deleteIpAddress.php
create mode 100644 examples/ColocationService-getColoOverview.php
create mode 100644 examples/ColocationService-requestAccess.php
create mode 100644 examples/ColocationService-requestRemoteHands.php
create mode 100644 examples/ColocationService-setReverseDns.php
create mode 100644 examples/DnsService-getDnsSecEntries.php
create mode 100644 examples/DnsService-setDnsEntries.php
create mode 100644 examples/DnsService-setDnsSecEntries.php
create mode 100644 examples/DomainService-batchCheckAvailability.php
create mode 100644 examples/DomainService-batchGetInfo.php
create mode 100644 examples/DomainService-cancel.php
create mode 100644 examples/DomainService-checkAvailability.php
create mode 100644 examples/DomainService-domainActions.php
create mode 100644 examples/DomainService-getAllTldInfos.php
create mode 100644 examples/DomainService-getAuthCode.php
create mode 100644 examples/DomainService-getDomainNames.php
create mode 100644 examples/DomainService-getInfo.php
create mode 100644 examples/DomainService-getWhois.php
create mode 100644 examples/DomainService-register-dns.php
create mode 100644 examples/DomainService-register-nameserver.php
create mode 100644 examples/DomainService-register-whois.php
create mode 100644 examples/DomainService-register.php
create mode 100644 examples/DomainService-setContacts.php
create mode 100644 examples/DomainService-setLock.php
create mode 100644 examples/DomainService-setNameservers.php
create mode 100644 examples/DomainService-setOwner.php
create mode 100644 examples/DomainService-transfer.php
create mode 100644 examples/ForwardService-order.php
create mode 100644 examples/HaipService-addCertificateToHaip.php
create mode 100644 examples/HaipService-addHaipPortConfiguration.php
create mode 100644 examples/HaipService-addPortConfiguration.php
create mode 100644 examples/HaipService-cancelHaip.php
create mode 100644 examples/HaipService-changeHaipVps.php
create mode 100644 examples/HaipService-deleteCertificateFromHaip.php
create mode 100644 examples/HaipService-deleteHaipPortConfiguration.php
create mode 100644 examples/HaipService-deletePortConfiguration.php
create mode 100644 examples/HaipService-getAvailableCertificatesByHaip.php
create mode 100644 examples/HaipService-getCertificatesByHaip.php
create mode 100644 examples/HaipService-getHaip.php
create mode 100644 examples/HaipService-getHaipPortConfigurations.php
create mode 100644 examples/HaipService-getHaips.php
create mode 100644 examples/HaipService-getPortConfigurations.php
create mode 100644 examples/HaipService-getPtrForHaip.php
create mode 100644 examples/HaipService-getStatusReport.php
create mode 100644 examples/HaipService-setBalancingMode.php
create mode 100644 examples/HaipService-setDefaultPortConfiguration.php
create mode 100644 examples/HaipService-setHaipDescription.php
create mode 100644 examples/HaipService-setHaipVpses.php
create mode 100644 examples/HaipService-setHttpHealthCheck.php
create mode 100644 examples/HaipService-setIpSetup.php
create mode 100644 examples/HaipService-setPtrForHaip.php
create mode 100644 examples/HaipService-setTcpHealthCheck.php
create mode 100644 examples/HaipService-startHaipLetsEncryptCertificateIssue.php
create mode 100644 examples/HaipService-updateHaipPortConfiguration.php
create mode 100644 examples/HaipService-updatePortConfiguration.php
create mode 100644 examples/PropositionService-getPropositionStatus.php
create mode 100644 examples/VpsService-addIpv6ToVps.php
create mode 100644 examples/VpsService-addVpsToPrivateNetwork.php
create mode 100644 examples/VpsService-cancelAddon.php
create mode 100644 examples/VpsService-cancelPrivateNetwork.php
create mode 100644 examples/VpsService-cancelVps.php
create mode 100644 examples/VpsService-cloneVps.php
create mode 100644 examples/VpsService-createSnapshot.php
create mode 100644 examples/VpsService-getActiveAddonsForVps.php
create mode 100644 examples/VpsService-getAllIps.php
create mode 100644 examples/VpsService-getAllPrivateNetworks.php
create mode 100644 examples/VpsService-getAvailabilityZones.php
create mode 100644 examples/VpsService-getAvailableAddons.php
create mode 100644 examples/VpsService-getAvailableAddonsForVps.php
create mode 100644 examples/VpsService-getAvailableProducts.php
create mode 100644 examples/VpsService-getAvailableUpgrades.php
create mode 100644 examples/VpsService-getCancellableAddonsForVps.php
create mode 100644 examples/VpsService-getIpsForVps.php
create mode 100644 examples/VpsService-getOperatingSystems.php
create mode 100644 examples/VpsService-getPooledTrafficInformation.php
create mode 100644 examples/VpsService-getPrivateNetworksByVps.php
create mode 100644 examples/VpsService-getSnapshotsByVps.php
create mode 100644 examples/VpsService-getTrafficInformationForVps.php
create mode 100644 examples/VpsService-getVps.php
create mode 100644 examples/VpsService-getVpsBackupsByVps.php
create mode 100644 examples/VpsService-getVpses.php
create mode 100644 examples/VpsService-handoverVps.php
create mode 100644 examples/VpsService-installOperatingSystem.php
create mode 100644 examples/VpsService-installOperatingSystemUnattended.php
create mode 100644 examples/VpsService-orderAddon.php
create mode 100644 examples/VpsService-orderPrivateNetwork.php
create mode 100644 examples/VpsService-orderVps.php
create mode 100644 examples/VpsService-removeSnapshot.php
create mode 100644 examples/VpsService-removeVpsFromPrivateNetwork.php
create mode 100644 examples/VpsService-reset.php
create mode 100644 examples/VpsService-revertSnapshot.php
create mode 100644 examples/VpsService-revertSnapshotToOtherVps.php
create mode 100644 examples/VpsService-revertVpsBackup.php
create mode 100644 examples/VpsService-setCustomerLock.php
create mode 100644 examples/VpsService-start.php
create mode 100644 examples/VpsService-stop.php
create mode 100644 examples/VpsService-updatePtrRecord.php
create mode 100644 examples/VpsService-upgradeVps.php
create mode 100644 examples/WebhostingService-createMailBox.php
create mode 100644 examples/WebhostingService-getInfo.php
create mode 100644 examples/WebhostingService-getWebhostingDomainNames.php
create mode 100644 examples/WebhostingService-order_and_upgrade.php
diff --git a/CHANGELOG b/CHANGELOG
new file mode 100644
index 0000000..a9ad921
--- /dev/null
+++ b/CHANGELOG
@@ -0,0 +1,115 @@
+TRANSIP API V5.9
+
+NEW
+ - Added a function to request the authcode of a domain at the dnsBE or EURid registries
+
+TRANSIP API V5.8
+
+NEW
+ - Added Pooled Traffic for VPS
+
+TRANSIP API V5.7
+
+NEW
+ - Added AvailabilityZones
+
+TRANSIP API V5.6
+
+NEW
+ - Added custom target ports for HA-IP
+ Use different source and destination ports for a HA-IP configuration.
+ - Added option to configure SSL between HA-IP and VPS
+ For each configuration specify whether the connection between HA-IP and the VPS is secured.
+ - Added HA-IP Pro support
+ Attach multiple VPSes to a HA-IP, and modify load balancing settings.
+
+TRANSIP API V5.5
+
+NEW
+ - Added HA-IP Certificates
+ HTTPS Offloading on our proxy's
+ - Add LetsEncrypt certificate to HA-IP
+ Let transip handle your Lets Encrypt certificate and renewals automatically
+ - Change proxy modes: HTTP, HTTPS, TCP, PROXY
+ Use HTTPS modus for SSL offloading. HTTP/HTTPS mode will also set the X-Forwarded-For Header.
+
+TRANSIP API V5.4
+
+NEW
+ - Added HaipService
+ With which you can list your Haips and change the coupled Vps to your Haip
+
+TRANSIP API V5.3
+
+NEW
+ - Added VpsService::installOperatingSystemUnattended
+ Start a installation with a custom preseed/kickstart provided via the api (base64_encoded)
+
+TRANSIP API V5.2
+
+NEW
+ - Added VpsService::cloneVps
+ The ability to clone a VPS to a new VPS
+
+ - Added VpsService::revertSnapshotToOtherVps
+ Revert a snapshot from any vps to any vps
+
+ - Added VpsService::revertVpsBackup
+ Revert a automated VPS backup
+
+
+TRANSIP API V5.1
+
+NEW
+ - Added VpsService::getTrafficInformationForVps
+ This method provides more information about your traffic usage
+
+ - Added VpsService::handoverVps
+ With this method you will be able to start the push handover process to another TransIP Account
+
+ - Added VpsService::setCustomerLock
+ Enable or disable the customerlock via the Api
+
+DEPRECATED:
+ - VpsService::getAmountOfTrafficUsed (still works for now)
+
+
+TRANSIP API V5.0
+
+NEW
+ - Added Support for VPS
+
+
+TRANSIP API V4.2.1
+
+NEW
+ - The RSA part of the private key is no longer required for newly generated keys
+
+
+TRANSIP API V4.1
+
+NEW
+ - Single distribution for all TransIP countries: added Transip_ApiSettings::$endpoint to determine which endpoint to target when making API requests
+
+
+TRANSIP API V4.0
+
+NEW:
+ - Improved security by using SSL based signatures for API requests.
+
+
+TRANSIP API V3.0
+
+NEW:
+ - check up to 20 domains within one call: Transip_DomainService::batchCheckAvailability()
+ - get information (price, renewal period, possible actions) about all TLDs offered with Transip_DomainService::getAllTldInfos() and Transip_DomainService::getTldInfo()
+ - get the current running action a domain is doing and/or retry/cancel with getCurrentDomainAction(), retryCurrentDomainActionWithNewData(), retryTransferWithDifferentAuthCode(), cancelDomainAction()
+ - The domain object now holds information registrationDate, renewalDate, authCode and isLocked status
+ - Get all Colocation items with ColocationService::getColoNames()
+ - Manage IP/Network info with getIpRanges(), createIpAddress(), and more
+ - Manage, order and modify Forwards with the ForwardService
+ - Manage, order and modify Webhosting with the WebhostingService
+
+DEPRECATED:
+ - Transip_DomainService::getAuthCode(). Returned in Transip_DomainService::getInfo() now.
+ - Transip_DomainService::getIsLocked(). Returned in Transip_DomainService::getInfo() now.
diff --git a/Transip/ApiSettings.php b/Transip/ApiSettings.php
new file mode 100644
index 0000000..9a98a06
--- /dev/null
+++ b/Transip/ApiSettings.php
@@ -0,0 +1,43 @@
+
diff --git a/Transip/ColocationService.php b/Transip/ColocationService.php
new file mode 100644
index 0000000..3801ffc
--- /dev/null
+++ b/Transip/ColocationService.php
@@ -0,0 +1,305 @@
+' . implode("
\n
", $errors) . '
');
+
+ $classMap = array(
+ 'DataCenterVisitor' => 'Transip_DataCenterVisitor',
+ );
+
+ $options = array(
+ 'classmap' => $classMap,
+ 'encoding' => 'utf-8', // lets support unicode
+ 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // see http://bugs.php.net/bug.php?id=43338
+ 'trace' => false, // can be used for debugging
+ );
+
+ $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;
+ }
+
+ /**
+ * Calculates the hash to sign our request with based on the given parameters.
+ *
+ * @param mixed $parameters The parameters to sign.
+ * @return string Base64 encoded signing hash.
+ */
+ protected static function _sign($parameters)
+ {
+ // Fixup our private key, copy-pasting the key might lead to whitespace faults
+ if(!preg_match('/-----BEGIN (RSA )?PRIVATE KEY-----(.*)-----END (RSA )?PRIVATE KEY-----/si', Transip_ApiSettings::$privateKey, $matches))
+ die('
Could not find your private key, please supply your private key in the ApiSettings file. You can request a new private key in your TransIP Controlpanel.
Could not sign your request, please supply your private key in the ApiSettings file. You can request a new private key in your TransIP Controlpanel.
');
+
+ return base64_encode($signature);
+ }
+
+ /**
+ * Creates a digest of the given data, with an asn1 header.
+ *
+ * @param string $data The data to create a digest of.
+ * @return string The digest of the data, with asn1 header.
+ */
+ protected static function _sha512Asn1($data)
+ {
+ $digest = hash('sha512', $data, true);
+
+ // this ASN1 header is sha512 specific
+ $asn1 = chr(0x30).chr(0x51);
+ $asn1 .= chr(0x30).chr(0x0d);
+ $asn1 .= chr(0x06).chr(0x09);
+ $asn1 .= chr(0x60).chr(0x86).chr(0x48).chr(0x01).chr(0x65);
+ $asn1 .= chr(0x03).chr(0x04);
+ $asn1 .= chr(0x02).chr(0x03);
+ $asn1 .= chr(0x05).chr(0x00);
+ $asn1 .= chr(0x04).chr(0x40);
+ $asn1 .= $digest;
+
+ return $asn1;
+ }
+
+ /**
+ * Encodes the given paramaters into a url encoded string based upon RFC 3986.
+ *
+ * @param mixed $parameters The parameters to encode.
+ * @param string $keyPrefix Key prefix.
+ * @return string The given parameters encoded according to RFC 3986.
+ */
+ protected static function _encodeParameters($parameters, $keyPrefix = null)
+ {
+ if(!is_array($parameters) && !is_object($parameters))
+ return self::_urlencode($parameters);
+
+ $encodedData = array();
+
+ foreach($parameters as $key => $value)
+ {
+ $encodedKey = is_null($keyPrefix)
+ ? self::_urlencode($key)
+ : $keyPrefix . '[' . self::_urlencode($key) . ']';
+
+ if(is_array($value) || is_object($value))
+ {
+ $encodedData[] = self::_encodeParameters($value, $encodedKey);
+ }
+ else
+ {
+ $encodedData[] = $encodedKey . '=' . self::_urlencode($value);
+ }
+ }
+
+ return implode('&', $encodedData);
+ }
+
+ /**
+ * Our own function to encode a string according to RFC 3986 since.
+ * PHP < 5.3.0 encodes the ~ character which is not allowed.
+ *
+ * @param string $string The string to encode.
+ * @return string The encoded string according to RFC 3986.
+ */
+ protected static function _urlencode($string)
+ {
+ $string = trim($string);
+ $string = rawurlencode($string);
+ return str_replace('%7E', '~', $string);
+ }
+
+ const TRACK_ENDPOINT_NAME = 'Colocation';
+
+ /**
+ * Requests access to the data-center
+ *
+ * @param string $when the datetime of the wanted datacenter access, in YYYY-MM-DD hh:mm:ss format
+ * @param int $duration the expected duration of the visit, in minutes
+ * @param string[] $visitors the names of the visitors for this data-center visit, must be at least 1 and at most 20
+ * @param string $phoneNumber if an SMS with access codes needs to be sent, set the phonenumber of the receiving phone here;
+ * @return Transip_DataCenterVisitor[] An array of Visitor objects holding information (such as reservation and access number) about
+ * @throws ApiException
+ */
+ public static function requestAccess($when, $duration, $visitors, $phoneNumber)
+ {
+ return self::_getSoapClient(array_merge(array($when, $duration, $visitors, $phoneNumber), array('__method' => 'requestAccess')))->requestAccess($when, $duration, $visitors, $phoneNumber);
+ }
+
+ /**
+ * Request remote hands to the data-center
+ *
+ * @param string $coloName The name of the colocation
+ * @param string $contactName The contact name
+ * @param string $phoneNumber Phone number to contact
+ * @param int $expectedDuration Expected duration of the job in minutes
+ * @param string $instructions What to do
+ * @throws ApiException
+ */
+ public static function requestRemoteHands($coloName, $contactName, $phoneNumber, $expectedDuration, $instructions)
+ {
+ return self::_getSoapClient(array_merge(array($coloName, $contactName, $phoneNumber, $expectedDuration, $instructions), array('__method' => 'requestRemoteHands')))->requestRemoteHands($coloName, $contactName, $phoneNumber, $expectedDuration, $instructions);
+ }
+
+ /**
+ * Get coloNames for customer
+ *
+ * @return string[] Array with colo names
+ */
+ public static function getColoNames()
+ {
+ return self::_getSoapClient(array_merge(array(), array('__method' => 'getColoNames')))->getColoNames();
+ }
+
+ /**
+ * Get IpAddresses that are active and assigned to a Colo.
+ * Both ipv4 and ipv6 addresses are returned: ipv4 adresses in dot notation,
+ * ipv6 addresses in ipv6 presentation.
+ *
+ * @param string $coloName The name of the colo to get the ipaddresses for for
+ * @return string[] Array with assigned IPv4 and IPv6 addresses for the colo
+ */
+ public static function getIpAddresses($coloName)
+ {
+ return self::_getSoapClient(array_merge(array($coloName), array('__method' => 'getIpAddresses')))->getIpAddresses($coloName);
+ }
+
+ /**
+ * Get ipranges that are assigned to a Colo. Both ipv4 and ipv6 ranges are
+ * returned, in CIDR notation.
+ *
+ * @param string $coloName The name of the colo to get the ranges for
+ * @see http://en.wikipedia.org/wiki/CIDR_notation
+ * @return string[] Array of ipranges in CIDR format assigned to this colo.
+ */
+ public static function getIpRanges($coloName)
+ {
+ return self::_getSoapClient(array_merge(array($coloName), array('__method' => 'getIpRanges')))->getIpRanges($coloName);
+ }
+
+ /**
+ * Adds a new IpAddress, either an ipv6 or an ipv4 address.
+ * The service will validate the address, ensure the user is entitled
+ * to the address and will add the address to the correct Colo and range.
+ *
+ * @param string $ipAddress The IpAddress to create, can be either ipv4 or ipv6.
+ * @param string $reverseDns The RDNS name for this IpAddress
+ * @throws ApiException
+ */
+ public static function createIpAddress($ipAddress, $reverseDns)
+ {
+ return self::_getSoapClient(array_merge(array($ipAddress, $reverseDns), array('__method' => 'createIpAddress')))->createIpAddress($ipAddress, $reverseDns);
+ }
+
+ /**
+ * Deletes an IpAddress currently in use this account.
+ * IpAddress can be either ipv4 or ipv6. The service will validate
+ * if the user has rights to remove the address and will remove it completely,
+ * together with any RDNS or monitoring assigned to the address.
+ *
+ * @param string $ipAddress the IpAddress to delete, can be either ipv4 or ipv6.
+ */
+ public static function deleteIpAddress($ipAddress)
+ {
+ return self::_getSoapClient(array_merge(array($ipAddress), array('__method' => 'deleteIpAddress')))->deleteIpAddress($ipAddress);
+ }
+
+ /**
+ * Get the Reverse DNS for an IpAddress assigned to the user
+ * Throws an Exception when the Address does not exist or is not
+ * owned by the user.
+ *
+ * @param string $ipAddress the IpAddress, either ipv4 or ipv6
+ * @return string rdns
+ */
+ public static function getReverseDns($ipAddress)
+ {
+ return self::_getSoapClient(array_merge(array($ipAddress), array('__method' => 'getReverseDns')))->getReverseDns($ipAddress);
+ }
+
+ /**
+ * Set the RDNS name for an ipAddress.
+ * Throws an Exception when the Address does not exist or is not
+ * owned by the user.
+ *
+ * @param string $ipAddress The IpAddress to set the reverse dns for, can be either ipv4 or ipv6.
+ * @param string $reverseDns The new reverse DNS, must be a valid RDNS value.
+ */
+ public static function setReverseDns($ipAddress, $reverseDns)
+ {
+ return self::_getSoapClient(array_merge(array($ipAddress, $reverseDns), array('__method' => 'setReverseDns')))->setReverseDns($ipAddress, $reverseDns);
+ }
+}
+
+?>
diff --git a/Transip/Cronjob.php b/Transip/Cronjob.php
new file mode 100644
index 0000000..a93c0a1
--- /dev/null
+++ b/Transip/Cronjob.php
@@ -0,0 +1,102 @@
+name = $name;
+ $this->url = $url;
+ $this->email = $email;
+ $this->minuteTrigger = $minuteTrigger;
+ $this->hourTrigger = $hourTrigger;
+ $this->dayTrigger = $dayTrigger;
+ $this->monthTrigger = $monthTrigger;
+ $this->weekdayTrigger = $weekdayTrigger;
+ }
+}
+
+?>
diff --git a/Transip/DataCenterVisitor.php b/Transip/DataCenterVisitor.php
new file mode 100644
index 0000000..38ddae0
--- /dev/null
+++ b/Transip/DataCenterVisitor.php
@@ -0,0 +1,42 @@
+
diff --git a/Transip/Db.php b/Transip/Db.php
new file mode 100644
index 0000000..6b9a8ce
--- /dev/null
+++ b/Transip/Db.php
@@ -0,0 +1,49 @@
+name = $name;
+ $this->username = $username;
+ $this->maxDiskUsage = $maxDiskUsage;
+ }
+}
+
+?>
diff --git a/Transip/DnsEntry.php b/Transip/DnsEntry.php
new file mode 100644
index 0000000..89dd520
--- /dev/null
+++ b/Transip/DnsEntry.php
@@ -0,0 +1,70 @@
+name = $name;
+ $this->expire = $expire;
+ $this->type = $type;
+ $this->content = $content;
+ }
+}
+
+?>
diff --git a/Transip/DnsSecEntry.php b/Transip/DnsSecEntry.php
new file mode 100644
index 0000000..e9c0ef7
--- /dev/null
+++ b/Transip/DnsSecEntry.php
@@ -0,0 +1,86 @@
+ 3,
+ 1 => 5,
+ 2 => 6,
+ 3 => 7,
+ 4 => 8,
+ 5 => 10,
+ 6 => 12,
+ 7 => 13,
+ 8 => 14,
+ 9 => 15,
+ 10 => 16,
+);
+ const ALL_FLAGS = array (
+ 0 => 0,
+ 1 => 256,
+ 2 => 257,
+);
+
+ /**
+ *
+ *
+ * @var int $keyTag
+ */
+ public $keyTag;
+
+ /**
+ * For all supported flags see Transip_DnsSecEntry::ALL_FLAGS
+ *
+ * @var int $flags
+ */
+ public $flags;
+
+ /**
+ * For all supported algorithms see Transip_DnsSecEntry::ALL_ALGORITHMS
+ *
+ * @var int $algorithm
+ */
+ public $algorithm;
+
+ /**
+ *
+ *
+ * @var string $publicKey
+ */
+ public $publicKey;
+
+ /**
+ * DnsSecEntry constructor.
+ *
+ */
+ public function __construct($keyTag, $flags, $algorithm, $publicKey)
+ {
+ $this->keyTag = $keyTag;
+ $this->flags = $flags;
+ $this->algorithm = $algorithm;
+ $this->publicKey = $publicKey;
+ }
+}
+
+?>
diff --git a/Transip/DnsService.php b/Transip/DnsService.php
new file mode 100644
index 0000000..8e7a50a
--- /dev/null
+++ b/Transip/DnsService.php
@@ -0,0 +1,247 @@
+' . implode("\n
", $errors) . '
');
+
+ $classMap = array(
+ 'DnsEntry' => 'Transip_DnsEntry',
+ 'DnsSecEntry' => 'Transip_DnsSecEntry',
+ );
+
+ $options = array(
+ 'classmap' => $classMap,
+ 'encoding' => 'utf-8', // lets support unicode
+ 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // see http://bugs.php.net/bug.php?id=43338
+ 'trace' => false, // can be used for debugging
+ );
+
+ $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;
+ }
+
+ /**
+ * Calculates the hash to sign our request with based on the given parameters.
+ *
+ * @param mixed $parameters The parameters to sign.
+ * @return string Base64 encoded signing hash.
+ */
+ protected static function _sign($parameters)
+ {
+ // Fixup our private key, copy-pasting the key might lead to whitespace faults
+ if(!preg_match('/-----BEGIN (RSA )?PRIVATE KEY-----(.*)-----END (RSA )?PRIVATE KEY-----/si', Transip_ApiSettings::$privateKey, $matches))
+ die('
Could not find your private key, please supply your private key in the ApiSettings file. You can request a new private key in your TransIP Controlpanel.
Could not sign your request, please supply your private key in the ApiSettings file. You can request a new private key in your TransIP Controlpanel.
');
+
+ return base64_encode($signature);
+ }
+
+ /**
+ * Creates a digest of the given data, with an asn1 header.
+ *
+ * @param string $data The data to create a digest of.
+ * @return string The digest of the data, with asn1 header.
+ */
+ protected static function _sha512Asn1($data)
+ {
+ $digest = hash('sha512', $data, true);
+
+ // this ASN1 header is sha512 specific
+ $asn1 = chr(0x30).chr(0x51);
+ $asn1 .= chr(0x30).chr(0x0d);
+ $asn1 .= chr(0x06).chr(0x09);
+ $asn1 .= chr(0x60).chr(0x86).chr(0x48).chr(0x01).chr(0x65);
+ $asn1 .= chr(0x03).chr(0x04);
+ $asn1 .= chr(0x02).chr(0x03);
+ $asn1 .= chr(0x05).chr(0x00);
+ $asn1 .= chr(0x04).chr(0x40);
+ $asn1 .= $digest;
+
+ return $asn1;
+ }
+
+ /**
+ * Encodes the given paramaters into a url encoded string based upon RFC 3986.
+ *
+ * @param mixed $parameters The parameters to encode.
+ * @param string $keyPrefix Key prefix.
+ * @return string The given parameters encoded according to RFC 3986.
+ */
+ protected static function _encodeParameters($parameters, $keyPrefix = null)
+ {
+ if(!is_array($parameters) && !is_object($parameters))
+ return self::_urlencode($parameters);
+
+ $encodedData = array();
+
+ foreach($parameters as $key => $value)
+ {
+ $encodedKey = is_null($keyPrefix)
+ ? self::_urlencode($key)
+ : $keyPrefix . '[' . self::_urlencode($key) . ']';
+
+ if(is_array($value) || is_object($value))
+ {
+ $encodedData[] = self::_encodeParameters($value, $encodedKey);
+ }
+ else
+ {
+ $encodedData[] = $encodedKey . '=' . self::_urlencode($value);
+ }
+ }
+
+ return implode('&', $encodedData);
+ }
+
+ /**
+ * Our own function to encode a string according to RFC 3986 since.
+ * PHP < 5.3.0 encodes the ~ character which is not allowed.
+ *
+ * @param string $string The string to encode.
+ * @return string The encoded string according to RFC 3986.
+ */
+ protected static function _urlencode($string)
+ {
+ $string = trim($string);
+ $string = rawurlencode($string);
+ return str_replace('%7E', '~', $string);
+ }
+
+ const TRACK_ENDPOINT_NAME = 'Dns';
+
+ /**
+ * Sets the DnEntries for this Domain, will replace all existing dns entries with the new entries
+ *
+ * @param string $domainName the domainName to change the dns entries for
- domainName must meet the requirements for a domain name described in: RFC 952
+ * @param Transip_DnsEntry[] $dnsEntries the list of new DnsEntries for this domain
+ * @example examples/DnsService-setDnsEntries.php
+ */
+ public static function setDnsEntries($domainName, $dnsEntries)
+ {
+ return self::_getSoapClient(array_merge(array($domainName, $dnsEntries), array('__method' => 'setDnsEntries')))->setDnsEntries($domainName, $dnsEntries);
+ }
+
+ /**
+ * Checks if the dnssec entries of a domain can be updated.
+ *
+ * @param string $domainName
+ * @return boolean
+ * @example examples/DnsService-setDnsSecEntries.php
+ */
+ public static function canEditDnsSec($domainName)
+ {
+ return self::_getSoapClient(array_merge(array($domainName), array('__method' => 'canEditDnsSec')))->canEditDnsSec($domainName);
+ }
+
+ /**
+ *
+ *
+ * @param string $domainName
+ * @return Transip_DnsSecEntry[]
+ * @example examples/DnsService-getDnsSecEntries.php
+ */
+ public static function getDnsSecEntries($domainName)
+ {
+ return self::_getSoapClient(array_merge(array($domainName), array('__method' => 'getDnsSecEntries')))->getDnsSecEntries($domainName);
+ }
+
+ /**
+ * Sets new DNSSEC key entries for a domain, replacing the current ones.
+ *
+ * @param string $domainName
+ * @param Transip_DnsSecEntry[] $dnssecKeyEntrySet
+ * @example examples/DnsService-setDnsSecEntries.php
+ */
+ public static function setDnsSecEntries($domainName, $dnssecKeyEntrySet)
+ {
+ return self::_getSoapClient(array_merge(array($domainName, $dnssecKeyEntrySet), array('__method' => 'setDnsSecEntries')))->setDnsSecEntries($domainName, $dnssecKeyEntrySet);
+ }
+
+ /**
+ * Remove all the DnsSecEntries from a domain.
+ *
+ * @param string $domainName
+ * @example examples/DnsService-setDnsSecEntries.php
+ */
+ public static function removeAllDnsSecEntries($domainName)
+ {
+ return self::_getSoapClient(array_merge(array($domainName), array('__method' => 'removeAllDnsSecEntries')))->removeAllDnsSecEntries($domainName);
+ }
+}
+
+?>
diff --git a/Transip/Domain.php b/Transip/Domain.php
new file mode 100644
index 0000000..b7a6a3c
--- /dev/null
+++ b/Transip/Domain.php
@@ -0,0 +1,105 @@
+RFC 952
+ *
+ * @var string
+ */
+ public $name = '';
+
+ /**
+ * The list of nameservers (with optional gluerecords) for this domain
+ *
+ * @var Transip_Nameserver[]
+ */
+ public $nameservers = array();
+
+ /**
+ * The list of WhoisContacts for this domain
+ *
+ * @var Transip_WhoisContact[]
+ */
+ public $contacts = array();
+
+ /**
+ * The list of DnsEntries for this domain
+ *
+ * @var Transip_DnsEntry[]
+ */
+ public $dnsEntries = array();
+
+ /**
+ * The branding for this domain, some Tlds support additional
+ * whois- and transfer-branding which will be stored in this variable.
+ * Even if a Tld does not support branding, it will
+ * always be stored in this variable for consistency.
+ *
+ * @var Transip_DomainBranding
+ */
+ public $branding;
+
+ /**
+ * The authcode for this domain as generated by the registry. Read-only.
+ *
+ * @var string
+ * @readonly
+ */
+ public $authCode = '';
+
+ /**
+ * If this domain supports locking, this flag is true when the domain is locked
+ * at the registry, false if not. Read-only.
+ *
+ * Use Transip_DomainService::setLock() to change the lock status of a domain.
+ *
+ * @var boolean
+ * @readonly
+ */
+ public $isLocked = false;
+
+ /**
+ * Registration date of the domain, in YYYY-mm-dd format. Read-only.
+ *
+ * @var string
+ * @readonly
+ */
+ public $registrationDate = '';
+
+ /**
+ * Next renewal date of the domain, in YYYY-mm-dd format. Read-only.
+ *
+ * @var string
+ * @readonly
+ */
+ public $renewalDate = '';
+
+ /**
+ * Constructs a new Domain
+ *
+ * @param string $name the domain name of the domain, including tld
+ * @param Nameserver[] $nameservers the list of nameservers (with optional gluerecords) for this domain
+ * @param WhoisContact[] $contacts the list of WhoisContacts for this domain
+ * @param DnsEntry[] $dnsEntries the list of DnsEntries for this domain
+ * @param DomainBranding $branding the branding for this domain, see the branding property for more info
+ */
+ public function __construct($name, $nameservers = array(), $contacts = array(), $dnsEntries = array(), $branding = null)
+ {
+ $this->name = $name;
+ $this->nameservers = $nameservers;
+ $this->contacts = $contacts;
+ $this->dnsEntries = $dnsEntries;
+ $this->branding = $branding;
+ }
+}
+
+?>
diff --git a/Transip/DomainAction.php b/Transip/DomainAction.php
new file mode 100644
index 0000000..ed0b56f
--- /dev/null
+++ b/Transip/DomainAction.php
@@ -0,0 +1,35 @@
+
diff --git a/Transip/DomainBranding.php b/Transip/DomainBranding.php
new file mode 100644
index 0000000..72217f3
--- /dev/null
+++ b/Transip/DomainBranding.php
@@ -0,0 +1,62 @@
+
diff --git a/Transip/DomainCheckResult.php b/Transip/DomainCheckResult.php
new file mode 100644
index 0000000..4de75fa
--- /dev/null
+++ b/Transip/DomainCheckResult.php
@@ -0,0 +1,45 @@
+RFC 952
+ *
+ * @var string;
+ */
+ public $domainName;
+
+ /**
+ * The status for this domain, one of the Transip_DomainService::AVAILABILITY_* constants.
+ *
+ * @var string
+ */
+ public $status;
+
+ /**
+ * List of available actions to perform on this domain
+ *
+ * @var string[]
+ */
+ public $actions;
+}
+
+?>
diff --git a/Transip/DomainService.php b/Transip/DomainService.php
new file mode 100644
index 0000000..5650c93
--- /dev/null
+++ b/Transip/DomainService.php
@@ -0,0 +1,528 @@
+' . implode("\n
Could not find your private key, please supply your private key in the ApiSettings file. You can request a new private key in your TransIP Controlpanel.
Could not sign your request, please supply your private key in the ApiSettings file. You can request a new private key in your TransIP Controlpanel.
');
+
+ return base64_encode($signature);
+ }
+
+ /**
+ * Creates a digest of the given data, with an asn1 header.
+ *
+ * @param string $data The data to create a digest of.
+ * @return string The digest of the data, with asn1 header.
+ */
+ protected static function _sha512Asn1($data)
+ {
+ $digest = hash('sha512', $data, true);
+
+ // this ASN1 header is sha512 specific
+ $asn1 = chr(0x30).chr(0x51);
+ $asn1 .= chr(0x30).chr(0x0d);
+ $asn1 .= chr(0x06).chr(0x09);
+ $asn1 .= chr(0x60).chr(0x86).chr(0x48).chr(0x01).chr(0x65);
+ $asn1 .= chr(0x03).chr(0x04);
+ $asn1 .= chr(0x02).chr(0x03);
+ $asn1 .= chr(0x05).chr(0x00);
+ $asn1 .= chr(0x04).chr(0x40);
+ $asn1 .= $digest;
+
+ return $asn1;
+ }
+
+ /**
+ * Encodes the given paramaters into a url encoded string based upon RFC 3986.
+ *
+ * @param mixed $parameters The parameters to encode.
+ * @param string $keyPrefix Key prefix.
+ * @return string The given parameters encoded according to RFC 3986.
+ */
+ protected static function _encodeParameters($parameters, $keyPrefix = null)
+ {
+ if(!is_array($parameters) && !is_object($parameters))
+ return self::_urlencode($parameters);
+
+ $encodedData = array();
+
+ foreach($parameters as $key => $value)
+ {
+ $encodedKey = is_null($keyPrefix)
+ ? self::_urlencode($key)
+ : $keyPrefix . '[' . self::_urlencode($key) . ']';
+
+ if(is_array($value) || is_object($value))
+ {
+ $encodedData[] = self::_encodeParameters($value, $encodedKey);
+ }
+ else
+ {
+ $encodedData[] = $encodedKey . '=' . self::_urlencode($value);
+ }
+ }
+
+ return implode('&', $encodedData);
+ }
+
+ /**
+ * Our own function to encode a string according to RFC 3986 since.
+ * PHP < 5.3.0 encodes the ~ character which is not allowed.
+ *
+ * @param string $string The string to encode.
+ * @return string The encoded string according to RFC 3986.
+ */
+ protected static function _urlencode($string)
+ {
+ $string = trim($string);
+ $string = rawurlencode($string);
+ return str_replace('%7E', '~', $string);
+ }
+
+ const AVAILABILITY_INYOURACCOUNT = 'inyouraccount';
+ const AVAILABILITY_UNAVAILABLE = 'unavailable';
+ const AVAILABILITY_NOTFREE = 'notfree';
+ const AVAILABILITY_FREE = 'free';
+ const AVAILABILITY_INTERNALPULL = 'internalpull';
+ const CANCELLATIONTIME_END = 'end';
+ const CANCELLATIONTIME_IMMEDIATELY = 'immediately';
+ const ACTION_REGISTER = 'register';
+ const ACTION_TRANSFER = 'transfer';
+ const ACTION_INTERNALPULL = 'internalpull';
+ const TRACK_ENDPOINT_NAME = 'Domain';
+
+ /**
+ * Checks the availability of multiple domains.
+ *
+ * @param string[] $domainNames The domain names to check for availability.
- A maximum of 20 domainNames at once can be checked. - domainNames must meet the requirements for a domain name described in: RFC 952
+ * @example examples/DomainService-batchCheckAvailability.php
+ * @throws ApiException
+ * @return Transip_DomainCheckResult[] A list of DomainCheckResult objects, holding the domainName and the status per result.
+ */
+ public static function batchCheckAvailability($domainNames)
+ {
+ return self::_getSoapClient(array_merge(array($domainNames), array('__method' => 'batchCheckAvailability')))->batchCheckAvailability($domainNames);
+ }
+
+ /**
+ * Checks the availability of a domain.
+ *
+ * @param string $domainName The domain name to check for availability.
- domainName must meet the requirements for a domain name described in: RFC 952
+ * @return string the availability status of the domain name:
- free the domain is free for registration - notfree the domain is not free for new registration, but can possibly be transferred - inyouraccount the domain is already in your account - unavailable the domain is not available for registration
+ * @example examples/DomainService-checkAvailability.php
+ */
+ public static function checkAvailability($domainName)
+ {
+ return self::_getSoapClient(array_merge(array($domainName), array('__method' => 'checkAvailability')))->checkAvailability($domainName);
+ }
+
+ /**
+ * Gets the whois of a domain name
+ *
+ * @param string $domainName the domain name to get the whois for
- domainName must meet the requirements for a domain name described in: RFC 952
+ * @return string the whois data for the domain
+ * @throws ApiException
+ * @example examples/DomainService-getWhois.php
+ */
+ public static function getWhois($domainName)
+ {
+ return self::_getSoapClient(array_merge(array($domainName), array('__method' => 'getWhois')))->getWhois($domainName);
+ }
+
+ /**
+ * Gets the names of all domains in your account.
+ *
+ * @return string[] A list of all domains in your account
+ * @example examples/DomainService-getDomainNames.php
+ */
+ public static function getDomainNames()
+ {
+ return self::_getSoapClient(array_merge(array(), array('__method' => 'getDomainNames')))->getDomainNames();
+ }
+
+ /**
+ * Get information about a domainName.
+ *
+ * @param string $domainName The domainName to get the information for.
- domainName must meet the requirements for a domain name described in: RFC 952
+ * @example examples/DomainService-DomainService-getInfo.php
+ * @throws ApiException If the Domain could not be found.
+ * @return Transip_Domain A Domain object holding the data for the requested domainName.
+ */
+ public static function getInfo($domainName)
+ {
+ return self::_getSoapClient(array_merge(array($domainName), array('__method' => 'getInfo')))->getInfo($domainName);
+ }
+
+ /**
+ * Get information about a list of Domain names.
+ *
+ * @param string[] $domainNames A list of Domain names you want information for.
- domainNames must meet the requirements for a domain name described in: RFC 952
+ * @throws Exception If something else went wrong.
+ * @return Transip_Domain[] Domain objects.
+ */
+ public static function batchGetInfo($domainNames)
+ {
+ return self::_getSoapClient(array_merge(array($domainNames), array('__method' => 'batchGetInfo')))->batchGetInfo($domainNames);
+ }
+
+ /**
+ * Gets the Auth code for a domainName
+ *
+ * @param string $domainName the domainName to get the authcode for
- domainName must meet the requirements for a domain name described in: RFC 952
+ * @deprecated
+ * @return string the authentication code for a domain name
+ * @example examples/DomainService-DomainService-getAuthCode.php
+ */
+ public static function getAuthCode($domainName)
+ {
+ return self::_getSoapClient(array_merge(array($domainName), array('__method' => 'getAuthCode')))->getAuthCode($domainName);
+ }
+
+ /**
+ * Gets the lock status for a domainName
+ *
+ * @param string $domainName the domainName to get the lock status for
- domainName must meet the requirements for a domain name described in: RFC 952
+ * @return boolean true iff the domain is locked at the registry
+ * @deprecated use getInfo()
+ */
+ public static function getIsLocked($domainName)
+ {
+ return self::_getSoapClient(array_merge(array($domainName), array('__method' => 'getIsLocked')))->getIsLocked($domainName);
+ }
+
+ /**
+ * Registers a domain name, will automatically create and sign a proposition for it
+ *
+ * @param Transip_Domain $domain The Domain object holding information about the domain that needs to be registered.
+ * @requires readwrite mode
+ * @example examples/DomainService-DomainService-register-whois.php
+ * @return string proposition number
+ * @throws ApiException
+ */
+ public static function register($domain)
+ {
+ return self::_getSoapClient(array_merge(array($domain), array('__method' => 'register')))->register($domain);
+ }
+
+ /**
+ * Cancels a domain name, will automatically create and sign a cancellation document
+ * Please note that domains with webhosting cannot be cancelled through the API
+ *
+ * @param string $domainName The domainname that needs to be cancelled.
- domainName must meet the requirements for a domain name described in: RFC 952
+ * @param string $endTime The time to cancel the domain (DomainService::CANCELLATIONTIME_END (end of contract)
+ * @requires readwrite mode
+ * @example examples/DomainService-DomainService-cancel.php
+ * @throws ApiException
+ */
+ public static function cancel($domainName, $endTime)
+ {
+ return self::_getSoapClient(array_merge(array($domainName, $endTime), array('__method' => 'cancel')))->cancel($domainName, $endTime);
+ }
+
+ /**
+ * Transfers a domain with changing the owner, not all TLDs support this (e.g. nl)
+ *
+ * @param Transip_Domain $domain the Domain object holding information about the domain that needs to be transfered
+ * @param string $authCode the authorization code for domains needing this for transfers (e.g. .com or .org transfers). Leave empty when n/a.
+ * @return string proposition number
+ * @requires readwrite mode
+ * @example examples/DomainService-DomainService-transfer.php
+ */
+ public static function transferWithOwnerChange($domain, $authCode)
+ {
+ return self::_getSoapClient(array_merge(array($domain, $authCode), array('__method' => 'transferWithOwnerChange')))->transferWithOwnerChange($domain, $authCode);
+ }
+
+ /**
+ * Transfers a domain without changing the owner
+ *
+ * @param Transip_Domain $domain the Domain object holding information about the domain that needs to be transfered
+ * @param string $authCode the authorization code for domains needing this for transfers (e.g. .com or .org transfers). Leave empty when n/a.
+ * @return string proposition number
+ * @requires readwrite mode
+ * @example examples/DomainService-DomainService-transfer.php
+ */
+ public static function transferWithoutOwnerChange($domain, $authCode)
+ {
+ return self::_getSoapClient(array_merge(array($domain, $authCode), array('__method' => 'transferWithoutOwnerChange')))->transferWithoutOwnerChange($domain, $authCode);
+ }
+
+ /**
+ * Starts a nameserver change for this domain, will replace all existing nameservers with the new nameservers
+ *
+ * @param string $domainName the domainName to change the nameservers for
domainName must meet the requirements for a domain name described in: RFC 952
+ * @param Transip_Nameserver[] $nameservers the list of new nameservers for this domain
+ * @example examples/DomainService-DomainService-setNameservers.php
+ */
+ public static function setNameservers($domainName, $nameservers)
+ {
+ return self::_getSoapClient(array_merge(array($domainName, $nameservers), array('__method' => 'setNameservers')))->setNameservers($domainName, $nameservers);
+ }
+
+ /**
+ * Lock this domain in real time
+ *
+ * @param string $domainName the domainName to set the lock for
- domainName must meet the requirements for a domain name described in: RFC 952
+ * @example examples/DomainService-DomainService-setLock.php
+ */
+ public static function setLock($domainName)
+ {
+ return self::_getSoapClient(array_merge(array($domainName), array('__method' => 'setLock')))->setLock($domainName);
+ }
+
+ /**
+ * unlocks this domain in real time
+ *
+ * @param string $domainName the domainName to unlock
- domainName must meet the requirements for a domain name described in: RFC 952
+ * @example examples/DomainService-DomainService-setLock.php
+ */
+ public static function unsetLock($domainName)
+ {
+ return self::_getSoapClient(array_merge(array($domainName), array('__method' => 'unsetLock')))->unsetLock($domainName);
+ }
+
+ /**
+ * Sets the DnEntries for this Domain, will replace all existing dns entries with the new entries
+ *
+ * @param string $domainName the domainName to change the dns entries for
- domainName must meet the requirements for a domain name described in: RFC 952
+ * @param Transip_DnsEntry[] $dnsEntries the list of new DnsEntries for this domain
+ * @deprecated Use DnsService.setDnsEntries instead.
+ */
+ public static function setDnsEntries($domainName, $dnsEntries)
+ {
+ return self::_getSoapClient(array_merge(array($domainName, $dnsEntries), array('__method' => 'setDnsEntries')))->setDnsEntries($domainName, $dnsEntries);
+ }
+
+ /**
+ * Starts an owner change of a Domain, brings additional costs with the following TLDs:
+ * .be
+ *
+ * @param string $domainName the domainName to change the owner for
- domainName must meet the requirements for a domain name described in: RFC 952
+ * @param Transip_WhoisContact $registrantWhoisContact the new contact data for this
+ * @example examples/DomainService-DomainService-setOwner.php
+ * @throws ApiException
+ */
+ public static function setOwner($domainName, $registrantWhoisContact)
+ {
+ return self::_getSoapClient(array_merge(array($domainName, $registrantWhoisContact), array('__method' => 'setOwner')))->setOwner($domainName, $registrantWhoisContact);
+ }
+
+ /**
+ * Starts a contact change of a domain, this will replace all existing contacts
+ *
+ * @param string $domainName the domainName to change the contacts for
- domainName must meet the requirements for a domain name described in: RFC 952
+ * @param Transip_WhoisContact[] $contacts the list of new contacts for this domain
+ * @throws ApiException
+ * @example examples/DomainService-DomainService-setContacts.php
+ */
+ public static function setContacts($domainName, $contacts)
+ {
+ return self::_getSoapClient(array_merge(array($domainName, $contacts), array('__method' => 'setContacts')))->setContacts($domainName, $contacts);
+ }
+
+ /**
+ * Get TransIP supported TLDs
+ *
+ * @return Transip_Tld[] Array of Tld objects
+ * @example examples/DomainService-DomainService-getAllTldInfos.php
+ */
+ public static function getAllTldInfos()
+ {
+ return self::_getSoapClient(array_merge(array(), array('__method' => 'getAllTldInfos')))->getAllTldInfos();
+ }
+
+ /**
+ * Get info about a specific TLD
+ *
+ * @param string $tldName The tld to get information about.
- tldName must meet the requirements for a domain name described in: RFC 952
+ * @example examples/DomainService-DomainService-getAllTldInfos.php
+ * @throws ApiException If the TLD could not be found.
+ * @return Transip_Tld Tld object with info about this Tld
+ */
+ public static function getTldInfo($tldName)
+ {
+ return self::_getSoapClient(array_merge(array($tldName), array('__method' => 'getTldInfo')))->getTldInfo($tldName);
+ }
+
+ /**
+ * Gets info about the action this domain is currently running
+ *
+ * @param string $domainName Name of the domain
- domainName must meet the requirements specified in: RFC 952.
+ * @return Transip_DomainAction if this domain is currently running an action, a corresponding DomainAction with info about the action will be returned. If there is no action running, null will be returned.
+ * @example examples/DomainService-DomainService-domainActions.php
+ */
+ public static function getCurrentDomainAction($domainName)
+ {
+ return self::_getSoapClient(array_merge(array($domainName), array('__method' => 'getCurrentDomainAction')))->getCurrentDomainAction($domainName);
+ }
+
+ /**
+ * Retries a failed domain action with new domain data. The Domain#name field must contain
+ * the name of the Domain, the nameserver, contacts, dnsEntries fields contain the new data for this domain.
+ * Set a field to null to not change the data.
+ *
+ * @param Transip_Domain $domain The domain with data to retry
+ * @example examples/DomainService-DomainService-domainActions.php
+ * @throws ApiException
+ */
+ public static function retryCurrentDomainActionWithNewData($domain)
+ {
+ return self::_getSoapClient(array_merge(array($domain), array('__method' => 'retryCurrentDomainActionWithNewData')))->retryCurrentDomainActionWithNewData($domain);
+ }
+
+ /**
+ * Retry a transfer action with a new authcode
+ *
+ * @param Transip_Domain $domain The domain to try the transfer with a different authcode for
+ * @param string $newAuthCode New authorization code to try
+ * @example examples/DomainService-DomainService-domainActions.php
+ * @throws ApiException
+ */
+ public static function retryTransferWithDifferentAuthCode($domain, $newAuthCode)
+ {
+ return self::_getSoapClient(array_merge(array($domain, $newAuthCode), array('__method' => 'retryTransferWithDifferentAuthCode')))->retryTransferWithDifferentAuthCode($domain, $newAuthCode);
+ }
+
+ /**
+ * Cancels a failed domain action
+ *
+ * @param Transip_Domain $domain the domain to cancel the action for
+ * @example examples/DomainService-DomainService-domainActions.php
+ * @throws ApiException
+ */
+ public static function cancelDomainAction($domain)
+ {
+ return self::_getSoapClient(array_merge(array($domain), array('__method' => 'cancelDomainAction')))->cancelDomainAction($domain);
+ }
+
+ /**
+ * Request the authcode at the registry
+ *
+ * This function will request the authcode for domains at DNS.be and EURid from the registry
+ *
+ * @param string $domainName the domainNAme to request the autocode for
- domainName must meet the requirements for a domain name described in: RFC 952
+ * @return string|null the authentication code for the domain name (or null)
+ * @throws ApiException
+ */
+ public static function requestAuthCode($domainName)
+ {
+ return self::_getSoapClient(array_merge(array($domainName), array('__method' => 'requestAuthCode')))->requestAuthCode($domainName);
+ }
+}
+
+?>
diff --git a/Transip/Forward.php b/Transip/Forward.php
new file mode 100644
index 0000000..edf03f1
--- /dev/null
+++ b/Transip/Forward.php
@@ -0,0 +1,101 @@
+domainName = $domainName;
+ $this->forwardTo = $forwardTo;
+ $this->forwardMethod = $forwardMethod;
+ $this->frameTitle = $frameTitle;
+ $this->frameIcon = $frameIcon;
+ $this->forwardEverything = $forwardEverything;
+ $this->forwardSubdomains = $forwardSubdomains;
+ $this->forwardEmailTo = $forwardEmailTo;
+ }
+}
+
+?>
diff --git a/Transip/ForwardService.php b/Transip/ForwardService.php
new file mode 100644
index 0000000..38fb036
--- /dev/null
+++ b/Transip/ForwardService.php
@@ -0,0 +1,240 @@
+' . implode("\n
", $errors) . '
');
+
+ $classMap = array(
+ 'Forward' => 'Transip_Forward',
+ );
+
+ $options = array(
+ 'classmap' => $classMap,
+ 'encoding' => 'utf-8', // lets support unicode
+ 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // see http://bugs.php.net/bug.php?id=43338
+ 'trace' => false, // can be used for debugging
+ );
+
+ $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;
+ }
+
+ /**
+ * Calculates the hash to sign our request with based on the given parameters.
+ *
+ * @param mixed $parameters The parameters to sign.
+ * @return string Base64 encoded signing hash.
+ */
+ protected static function _sign($parameters)
+ {
+ // Fixup our private key, copy-pasting the key might lead to whitespace faults
+ if(!preg_match('/-----BEGIN (RSA )?PRIVATE KEY-----(.*)-----END (RSA )?PRIVATE KEY-----/si', Transip_ApiSettings::$privateKey, $matches))
+ die('
Could not find your private key, please supply your private key in the ApiSettings file. You can request a new private key in your TransIP Controlpanel.
Could not sign your request, please supply your private key in the ApiSettings file. You can request a new private key in your TransIP Controlpanel.
');
+
+ return base64_encode($signature);
+ }
+
+ /**
+ * Creates a digest of the given data, with an asn1 header.
+ *
+ * @param string $data The data to create a digest of.
+ * @return string The digest of the data, with asn1 header.
+ */
+ protected static function _sha512Asn1($data)
+ {
+ $digest = hash('sha512', $data, true);
+
+ // this ASN1 header is sha512 specific
+ $asn1 = chr(0x30).chr(0x51);
+ $asn1 .= chr(0x30).chr(0x0d);
+ $asn1 .= chr(0x06).chr(0x09);
+ $asn1 .= chr(0x60).chr(0x86).chr(0x48).chr(0x01).chr(0x65);
+ $asn1 .= chr(0x03).chr(0x04);
+ $asn1 .= chr(0x02).chr(0x03);
+ $asn1 .= chr(0x05).chr(0x00);
+ $asn1 .= chr(0x04).chr(0x40);
+ $asn1 .= $digest;
+
+ return $asn1;
+ }
+
+ /**
+ * Encodes the given paramaters into a url encoded string based upon RFC 3986.
+ *
+ * @param mixed $parameters The parameters to encode.
+ * @param string $keyPrefix Key prefix.
+ * @return string The given parameters encoded according to RFC 3986.
+ */
+ protected static function _encodeParameters($parameters, $keyPrefix = null)
+ {
+ if(!is_array($parameters) && !is_object($parameters))
+ return self::_urlencode($parameters);
+
+ $encodedData = array();
+
+ foreach($parameters as $key => $value)
+ {
+ $encodedKey = is_null($keyPrefix)
+ ? self::_urlencode($key)
+ : $keyPrefix . '[' . self::_urlencode($key) . ']';
+
+ if(is_array($value) || is_object($value))
+ {
+ $encodedData[] = self::_encodeParameters($value, $encodedKey);
+ }
+ else
+ {
+ $encodedData[] = $encodedKey . '=' . self::_urlencode($value);
+ }
+ }
+
+ return implode('&', $encodedData);
+ }
+
+ /**
+ * Our own function to encode a string according to RFC 3986 since.
+ * PHP < 5.3.0 encodes the ~ character which is not allowed.
+ *
+ * @param string $string The string to encode.
+ * @return string The encoded string according to RFC 3986.
+ */
+ protected static function _urlencode($string)
+ {
+ $string = trim($string);
+ $string = rawurlencode($string);
+ return str_replace('%7E', '~', $string);
+ }
+
+ const CANCELLATIONTIME_END = 'end';
+ const CANCELLATIONTIME_IMMEDIATELY = 'immediately';
+ const TRACK_ENDPOINT_NAME = 'Forward';
+
+ /**
+ * Gets a list of all domains which have the Forward option enabled.
+ *
+ * @return string[] A list of all forwards enabled domains for the user
+ */
+ public static function getForwardDomainNames()
+ {
+ return self::_getSoapClient(array_merge(array(), array('__method' => 'getForwardDomainNames')))->getForwardDomainNames();
+ }
+
+ /**
+ * Gets information about a forwarded domain
+ *
+ * @param string $forwardDomainName The domain to get the info for
+ * @return Transip_Forward Forward object with all info if found, an exception otherwise
+ */
+ public static function getInfo($forwardDomainName)
+ {
+ return self::_getSoapClient(array_merge(array($forwardDomainName), array('__method' => 'getInfo')))->getInfo($forwardDomainName);
+ }
+
+ /**
+ * Order webhosting for a domain name
+ *
+ * @param Transip_Forward $forward info about the forward to order. Mandatory fields are $domainName. Other fields are optional.
+ */
+ public static function order($forward)
+ {
+ return self::_getSoapClient(array_merge(array($forward), array('__method' => 'order')))->order($forward);
+ }
+
+ /**
+ * Cancel webhosting for a domain
+ *
+ * @param string $forwardDomainName The domain name of the forward to cancel the forwarding service for
+ * @param string $endTime the time to cancel the domain (ForwardService::CANCELLATIONTIME_END (end of contract) or ForwardService::CANCELLATIONTIME_IMMEDIATELY (as soon as possible))
+ */
+ public static function cancel($forwardDomainName, $endTime)
+ {
+ return self::_getSoapClient(array_merge(array($forwardDomainName, $endTime), array('__method' => 'cancel')))->cancel($forwardDomainName, $endTime);
+ }
+
+ /**
+ * Modify the options of a Forward. All fields set in the Forward object will be changed.
+ *
+ * @param Transip_Forward $forward The forward to modify
+ */
+ public static function modify($forward)
+ {
+ return self::_getSoapClient(array_merge(array($forward), array('__method' => 'modify')))->modify($forward);
+ }
+}
+
+?>
diff --git a/Transip/Haip.php b/Transip/Haip.php
new file mode 100644
index 0000000..9a593ef
--- /dev/null
+++ b/Transip/Haip.php
@@ -0,0 +1,140 @@
+
diff --git a/Transip/HaipService.php b/Transip/HaipService.php
new file mode 100644
index 0000000..eee8324
--- /dev/null
+++ b/Transip/HaipService.php
@@ -0,0 +1,539 @@
+' . implode("\n
", $errors) . '
');
+
+ $classMap = array(
+ 'Haip' => 'Transip_Haip',
+ 'Vps' => 'Transip_Vps',
+ );
+
+ $options = array(
+ 'classmap' => $classMap,
+ 'encoding' => 'utf-8', // lets support unicode
+ 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // see http://bugs.php.net/bug.php?id=43338
+ 'trace' => false, // can be used for debugging
+ );
+
+ $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;
+ }
+
+ /**
+ * Calculates the hash to sign our request with based on the given parameters.
+ *
+ * @param mixed $parameters The parameters to sign.
+ * @return string Base64 encoded signing hash.
+ */
+ protected static function _sign($parameters)
+ {
+ // Fixup our private key, copy-pasting the key might lead to whitespace faults
+ if(!preg_match('/-----BEGIN (RSA )?PRIVATE KEY-----(.*)-----END (RSA )?PRIVATE KEY-----/si', Transip_ApiSettings::$privateKey, $matches))
+ die('
Could not find your private key, please supply your private key in the ApiSettings file. You can request a new private key in your TransIP Controlpanel.
Could not sign your request, please supply your private key in the ApiSettings file. You can request a new private key in your TransIP Controlpanel.
');
+
+ return base64_encode($signature);
+ }
+
+ /**
+ * Creates a digest of the given data, with an asn1 header.
+ *
+ * @param string $data The data to create a digest of.
+ * @return string The digest of the data, with asn1 header.
+ */
+ protected static function _sha512Asn1($data)
+ {
+ $digest = hash('sha512', $data, true);
+
+ // this ASN1 header is sha512 specific
+ $asn1 = chr(0x30).chr(0x51);
+ $asn1 .= chr(0x30).chr(0x0d);
+ $asn1 .= chr(0x06).chr(0x09);
+ $asn1 .= chr(0x60).chr(0x86).chr(0x48).chr(0x01).chr(0x65);
+ $asn1 .= chr(0x03).chr(0x04);
+ $asn1 .= chr(0x02).chr(0x03);
+ $asn1 .= chr(0x05).chr(0x00);
+ $asn1 .= chr(0x04).chr(0x40);
+ $asn1 .= $digest;
+
+ return $asn1;
+ }
+
+ /**
+ * Encodes the given paramaters into a url encoded string based upon RFC 3986.
+ *
+ * @param mixed $parameters The parameters to encode.
+ * @param string $keyPrefix Key prefix.
+ * @return string The given parameters encoded according to RFC 3986.
+ */
+ protected static function _encodeParameters($parameters, $keyPrefix = null)
+ {
+ if(!is_array($parameters) && !is_object($parameters))
+ return self::_urlencode($parameters);
+
+ $encodedData = array();
+
+ foreach($parameters as $key => $value)
+ {
+ $encodedKey = is_null($keyPrefix)
+ ? self::_urlencode($key)
+ : $keyPrefix . '[' . self::_urlencode($key) . ']';
+
+ if(is_array($value) || is_object($value))
+ {
+ $encodedData[] = self::_encodeParameters($value, $encodedKey);
+ }
+ else
+ {
+ $encodedData[] = $encodedKey . '=' . self::_urlencode($value);
+ }
+ }
+
+ return implode('&', $encodedData);
+ }
+
+ /**
+ * Our own function to encode a string according to RFC 3986 since.
+ * PHP < 5.3.0 encodes the ~ character which is not allowed.
+ *
+ * @param string $string The string to encode.
+ * @return string The encoded string according to RFC 3986.
+ */
+ protected static function _urlencode($string)
+ {
+ $string = trim($string);
+ $string = rawurlencode($string);
+ return str_replace('%7E', '~', $string);
+ }
+
+ const TRACK_ENDPOINT_NAME = 'HA-IP';
+ const CANCELLATIONTIME_END = 'end';
+ const CANCELLATIONTIME_IMMEDIATELY = 'immediately';
+
+ /**
+ * Get a HA-IP by name
+ *
+ * @param string $haipName The HA-IP name
+ * @throws ApiException
+ * @return Transip_Haip The vps objects
+ */
+ public static function getHaip($haipName)
+ {
+ return self::_getSoapClient(array_merge(array($haipName), array('__method' => 'getHaip')))->getHaip($haipName);
+ }
+
+ /**
+ * Get all HA-IPs
+ *
+ * @return Transip_Haip[] Array of HA-IP objects
+ */
+ public static function getHaips()
+ {
+ return self::_getSoapClient(array_merge(array(), array('__method' => 'getHaips')))->getHaips();
+ }
+
+ /**
+ * Changes the VPS connected to the HA-IP.
+ *
+ * @param string $haipName The HA-IP name
+ * @param string $vpsName The Vps name
+ * @throws ApiException
+ */
+ public static function changeHaipVps($haipName, $vpsName)
+ {
+ return self::_getSoapClient(array_merge(array($haipName, $vpsName), array('__method' => 'changeHaipVps')))->changeHaipVps($haipName, $vpsName);
+ }
+
+ /**
+ * Replaces currently attached VPSes to the HA-IP with the provided list of VPSes.
+ *
+ * @param string $haipName The HA-IP name
+ * @param string[] $vpsNames The Vps names
+ * @throws ApiException
+ */
+ public static function setHaipVpses($haipName, $vpsNames)
+ {
+ return self::_getSoapClient(array_merge(array($haipName, $vpsNames), array('__method' => 'setHaipVpses')))->setHaipVpses($haipName, $vpsNames);
+ }
+
+ /**
+ * Sets the provided IP setup for the HA-IP.
+ *
+ * @param string $haipName The HA-IP name
+ * @param string $ipSetup The IP setup ('both','noipv6','ipv6to4')
+ * @throws ApiException
+ */
+ public static function setIpSetup($haipName, $ipSetup)
+ {
+ return self::_getSoapClient(array_merge(array($haipName, $ipSetup), array('__method' => 'setIpSetup')))->setIpSetup($haipName, $ipSetup);
+ }
+
+ /**
+ * Sets the provided balancing mode for the HA-IP. The cookieName argument may be an empty string unless the
+ * balancing mode is set to 'cookie'.
+ *
+ * This is a HA-IP Pro feature.
+ *
+ * @param string $haipName The HA-IP name
+ * @param string $balancingMode The balancing mode ('roundrobin','cookie','source')
+ * @param string $cookieName The cookie name that pins the session if the balancing mode is 'cookie'
+ * @throws ApiException
+ */
+ public static function setBalancingMode($haipName, $balancingMode, $cookieName)
+ {
+ return self::_getSoapClient(array_merge(array($haipName, $balancingMode, $cookieName), array('__method' => 'setBalancingMode')))->setBalancingMode($haipName, $balancingMode, $cookieName);
+ }
+
+ /**
+ * Configures a HTTP health check for the HA-IP. To disable a HTTP health check use setTcpHealthCheck().
+ *
+ * This is a HA-IP Pro feature.
+ *
+ * @param string $haipName The HA-IP name
+ * @param string $path The path that will be accessed when performing health checks
+ * @param int $port The port that will be used when performing health checks
+ * @throws ApiException
+ */
+ public static function setHttpHealthCheck($haipName, $path, $port)
+ {
+ return self::_getSoapClient(array_merge(array($haipName, $path, $port), array('__method' => 'setHttpHealthCheck')))->setHttpHealthCheck($haipName, $path, $port);
+ }
+
+ /**
+ * Configures a TCP health check for the HA-IP (this is the default health check).
+ *
+ * This is a HA-IP Pro feature.
+ *
+ * @param string $haipName The HA-IP name
+ * @throws ApiException
+ */
+ public static function setTcpHealthCheck($haipName)
+ {
+ return self::_getSoapClient(array_merge(array($haipName), array('__method' => 'setTcpHealthCheck')))->setTcpHealthCheck($haipName);
+ }
+
+ /**
+ * Get a status report for the HA-IP.
+ *
+ * This is a HA-IP Pro feature.
+ *
+ * @param string $haipName The HA-IP name
+ * @throws ApiException
+ * @return array
+ */
+ public static function getStatusReport($haipName)
+ {
+ return self::_getSoapClient(array_merge(array($haipName), array('__method' => 'getStatusReport')))->getStatusReport($haipName);
+ }
+
+ /**
+ * Get all Certificates by Haip
+ *
+ * @param string $haipName
+ * @throws ApiException
+ * @return array
+ */
+ public static function getCertificatesByHaip($haipName)
+ {
+ return self::_getSoapClient(array_merge(array($haipName), array('__method' => 'getCertificatesByHaip')))->getCertificatesByHaip($haipName);
+ }
+
+ /**
+ * Get all available certificates ready to attach to your HAIP
+ *
+ * @param string $haipName
+ * @throws ApiException
+ * @return array
+ */
+ public static function getAvailableCertificatesByHaip($haipName)
+ {
+ return self::_getSoapClient(array_merge(array($haipName), array('__method' => 'getAvailableCertificatesByHaip')))->getAvailableCertificatesByHaip($haipName);
+ }
+
+ /**
+ * Add a HaipCertificate to this object
+ *
+ * @param string $haipName
+ * @param int $certificateId
+ * @throws ApiException
+ */
+ public static function addCertificateToHaip($haipName, $certificateId)
+ {
+ return self::_getSoapClient(array_merge(array($haipName, $certificateId), array('__method' => 'addCertificateToHaip')))->addCertificateToHaip($haipName, $certificateId);
+ }
+
+ /**
+ * Removes a Certificate from this HA-IP
+ *
+ * @param string $haipName
+ * @param int $certificateId
+ * @throws ApiException
+ */
+ public static function deleteCertificateFromHaip($haipName, $certificateId)
+ {
+ return self::_getSoapClient(array_merge(array($haipName, $certificateId), array('__method' => 'deleteCertificateFromHaip')))->deleteCertificateFromHaip($haipName, $certificateId);
+ }
+
+ /**
+ * Add EncryptCertificate to HA-IP
+ *
+ * @param string $haipName
+ * @param string $commonName
+ * @throws ApiException
+ */
+ public static function startHaipLetsEncryptCertificateIssue($haipName, $commonName)
+ {
+ return self::_getSoapClient(array_merge(array($haipName, $commonName), array('__method' => 'startHaipLetsEncryptCertificateIssue')))->startHaipLetsEncryptCertificateIssue($haipName, $commonName);
+ }
+
+ /**
+ * Returns the current ptr for the given HA-IP
+ *
+ * @param string $haipName
+ * @throws ApiException
+ * @return string
+ */
+ public static function getPtrForHaip($haipName)
+ {
+ return self::_getSoapClient(array_merge(array($haipName), array('__method' => 'getPtrForHaip')))->getPtrForHaip($haipName);
+ }
+
+ /**
+ * Update the ptr records for the given HA-IP
+ *
+ * @param string $haipName
+ * @param string $ptr
+ * @throws ApiException
+ */
+ public static function setPtrForHaip($haipName, $ptr)
+ {
+ return self::_getSoapClient(array_merge(array($haipName, $ptr), array('__method' => 'setPtrForHaip')))->setPtrForHaip($haipName, $ptr);
+ }
+
+ /**
+ * Update the description for HA-IP
+ *
+ * @param string $haipName
+ * @param string $description
+ * @throws ApiException
+ */
+ public static function setHaipDescription($haipName, $description)
+ {
+ return self::_getSoapClient(array_merge(array($haipName, $description), array('__method' => 'setHaipDescription')))->setHaipDescription($haipName, $description);
+ }
+
+ /**
+ * Get all port configurations for given HA-IP
+ *
+ * @param string $haipName The HA-IP name
+ * @deprecated Please use HaipService::getPortConfigurations()
+ * @throws ApiException
+ * @return array
+ */
+ public static function getHaipPortConfigurations($haipName)
+ {
+ return self::_getSoapClient(array_merge(array($haipName), array('__method' => 'getHaipPortConfigurations')))->getHaipPortConfigurations($haipName);
+ }
+
+ /**
+ * Get all port configurations for given HA-IP
+ *
+ * @param string $haipName The HA-IP name
+ * @throws ApiException
+ * @return array
+ */
+ public static function getPortConfigurations($haipName)
+ {
+ return self::_getSoapClient(array_merge(array($haipName), array('__method' => 'getPortConfigurations')))->getPortConfigurations($haipName);
+ }
+
+ /**
+ * Set default port configurations for given HA-IP
+ *
+ * @param string $haipName The HA-IP name
+ * @throws ApiException
+ */
+ public static function setDefaultPortConfiguration($haipName)
+ {
+ return self::_getSoapClient(array_merge(array($haipName), array('__method' => 'setDefaultPortConfiguration')))->setDefaultPortConfiguration($haipName);
+ }
+
+ /**
+ * Add port configuration to HA-IP
+ *
+ * @param string $haipName The HA-IP name
+ * @param string $name The name describing the port configuration
+ * @param int $portNumber The port that is addressed on the HA-IP IP
+ * @param string $mode The port mode ('tcp','http','https','proxy')
+ * @deprecated Please use HaipService::addPortConfiguration()
+ * @throws ApiException
+ */
+ public static function addHaipPortConfiguration($haipName, $name, $portNumber, $mode)
+ {
+ return self::_getSoapClient(array_merge(array($haipName, $name, $portNumber, $mode), array('__method' => 'addHaipPortConfiguration')))->addHaipPortConfiguration($haipName, $name, $portNumber, $mode);
+ }
+
+ /**
+ * Add port configuration to HA-IP
+ *
+ * @param string $haipName The HA-IP name
+ * @param string $name The name describing the port configuration
+ * @param int $sourcePort The port that is addressed on the HA-IP IP
+ * @param int $targetPort The port that is addressed on the VPS
+ * @param string $mode The port mode ('tcp','http','https','proxy')
+ * @param string $endpointSslMode The SSL mode for the endpoint ('off','on','strict')
+ * @throws ApiException
+ */
+ public static function addPortConfiguration($haipName, $name, $sourcePort, $targetPort, $mode, $endpointSslMode)
+ {
+ return self::_getSoapClient(array_merge(array($haipName, $name, $sourcePort, $targetPort, $mode, $endpointSslMode), array('__method' => 'addPortConfiguration')))->addPortConfiguration($haipName, $name, $sourcePort, $targetPort, $mode, $endpointSslMode);
+ }
+
+ /**
+ * Update port configuration to HA-IP
+ *
+ * @param string $haipName The HA-IP name
+ * @param int $configurationId The identifier for the configuration
+ * @param string $name The name describing the port configuration
+ * @param int $portNumber The port that is addressed on the HA-IP IP
+ * @param string $mode The port mode ('tcp','http','https','proxy')
+ * @deprecated Please use HaipService::updatePortConfiguration()
+ * @throws ApiException
+ */
+ public static function updateHaipPortConfiguration($haipName, $configurationId, $name, $portNumber, $mode)
+ {
+ return self::_getSoapClient(array_merge(array($haipName, $configurationId, $name, $portNumber, $mode), array('__method' => 'updateHaipPortConfiguration')))->updateHaipPortConfiguration($haipName, $configurationId, $name, $portNumber, $mode);
+ }
+
+ /**
+ * Update port configuration to HA-IP
+ *
+ * @param string $haipName The HA-IP name
+ * @param int $configurationId The identifier for the configuration
+ * @param string $name The name describing the port configuration
+ * @param int $sourcePort The port that is addressed on the HA-IP IP
+ * @param int $targetPort The port that is addressed on the VPS
+ * @param string $mode The port mode ('tcp','http','https','proxy')
+ * @param string $endpointSslMode The SSL mode for the endpoint ('off','on','strict')
+ * @throws ApiException
+ */
+ public static function updatePortConfiguration($haipName, $configurationId, $name, $sourcePort, $targetPort, $mode, $endpointSslMode)
+ {
+ return self::_getSoapClient(array_merge(array($haipName, $configurationId, $name, $sourcePort, $targetPort, $mode, $endpointSslMode), array('__method' => 'updatePortConfiguration')))->updatePortConfiguration($haipName, $configurationId, $name, $sourcePort, $targetPort, $mode, $endpointSslMode);
+ }
+
+ /**
+ * Delete configuration with the provided id from the HA-IP.
+ *
+ * @param string $haipName The HA-IP name
+ * @param int $configurationId The identifier for the configuration
+ * @deprecated Please use HaipService::deletePortConfiguration()
+ * @throws ApiException
+ */
+ public static function deleteHaipPortConfiguration($haipName, $configurationId)
+ {
+ return self::_getSoapClient(array_merge(array($haipName, $configurationId), array('__method' => 'deleteHaipPortConfiguration')))->deleteHaipPortConfiguration($haipName, $configurationId);
+ }
+
+ /**
+ *
+ *
+ * @param string $haipName
+ * @param int $configurationId
+ * @throws ApiException
+ */
+ public static function deletePortConfiguration($haipName, $configurationId)
+ {
+ return self::_getSoapClient(array_merge(array($haipName, $configurationId), array('__method' => 'deletePortConfiguration')))->deletePortConfiguration($haipName, $configurationId);
+ }
+
+ /**
+ * Cancel a Haip
+ *
+ * @param string $haipName The vps to cancel
+ * @param string $endTime The time to cancel the haip (HaipService::CANCELLATIONTIME_END (end of contract)
+ * @throws ApiException on error
+ */
+ public static function cancelHaip($haipName, $endTime)
+ {
+ return self::_getSoapClient(array_merge(array($haipName, $endTime), array('__method' => 'cancelHaip')))->cancelHaip($haipName, $endTime);
+ }
+}
+
+?>
diff --git a/Transip/MailBox.php b/Transip/MailBox.php
new file mode 100644
index 0000000..db34c85
--- /dev/null
+++ b/Transip/MailBox.php
@@ -0,0 +1,80 @@
+address = $address;
+ $this->spamCheckerStrength = $spamCheckerStrength;
+ $this->maxDiskUsage = $maxDiskUsage;
+ $this->hasVacationReply = $hasVacationReply;
+ $this->vacationReplySubject = $vacationReplySubject;
+ $this->vacationReplyMessage = $vacationReplyMessage;
+ }
+}
+
+?>
diff --git a/Transip/MailForward.php b/Transip/MailForward.php
new file mode 100644
index 0000000..b8f7342
--- /dev/null
+++ b/Transip/MailForward.php
@@ -0,0 +1,39 @@
+name = $name;
+ $this->targetAddress = $targetAddress;
+ }
+}
+
+?>
diff --git a/Transip/Nameserver.php b/Transip/Nameserver.php
new file mode 100644
index 0000000..e492a9d
--- /dev/null
+++ b/Transip/Nameserver.php
@@ -0,0 +1,50 @@
+hostname = $hostname;
+ $this->ipv4 = $ipv4;
+ $this->ipv6 = $ipv6;
+ }
+}
+
+?>
diff --git a/Transip/OperatingSystem.php b/Transip/OperatingSystem.php
new file mode 100644
index 0000000..b7b1cb7
--- /dev/null
+++ b/Transip/OperatingSystem.php
@@ -0,0 +1,41 @@
+
diff --git a/Transip/PrivateNetwork.php b/Transip/PrivateNetwork.php
new file mode 100644
index 0000000..5c7a0f7
--- /dev/null
+++ b/Transip/PrivateNetwork.php
@@ -0,0 +1,20 @@
+
diff --git a/Transip/Product.php b/Transip/Product.php
new file mode 100644
index 0000000..9f84c26
--- /dev/null
+++ b/Transip/Product.php
@@ -0,0 +1,41 @@
+
diff --git a/Transip/PropositionService.php b/Transip/PropositionService.php
new file mode 100644
index 0000000..801a505
--- /dev/null
+++ b/Transip/PropositionService.php
@@ -0,0 +1,194 @@
+' . implode("\n
", $errors) . '
');
+
+ $classMap = array(
+ );
+
+ $options = array(
+ 'classmap' => $classMap,
+ 'encoding' => 'utf-8', // lets support unicode
+ 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // see http://bugs.php.net/bug.php?id=43338
+ 'trace' => false, // can be used for debugging
+ );
+
+ $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;
+ }
+
+ /**
+ * Calculates the hash to sign our request with based on the given parameters.
+ *
+ * @param mixed $parameters The parameters to sign.
+ * @return string Base64 encoded signing hash.
+ */
+ protected static function _sign($parameters)
+ {
+ // Fixup our private key, copy-pasting the key might lead to whitespace faults
+ if(!preg_match('/-----BEGIN (RSA )?PRIVATE KEY-----(.*)-----END (RSA )?PRIVATE KEY-----/si', Transip_ApiSettings::$privateKey, $matches))
+ die('
Could not find your private key, please supply your private key in the ApiSettings file. You can request a new private key in your TransIP Controlpanel.
Could not find your private key, please supply your private key in the ApiSettings file. You can request a new private key in your TransIP Controlpanel.
Could not find your private key, please supply your private key in the ApiSettings file. You can request a new private key in your TransIP Controlpanel.
":"")?>
+ Fill out the form to create an access request
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/ColocationService-requestRemoteHands.php b/examples/ColocationService-requestRemoteHands.php
new file mode 100644
index 0000000..c4ae189
--- /dev/null
+++ b/examples/ColocationService-requestRemoteHands.php
@@ -0,0 +1,96 @@
+
+ */
+
+
+require_once('Transip/ColocationService.php');
+
+if(isset($_POST['request']) && count($_POST['request']) > 0)
+{
+ extract($_POST['request']);
+ try
+ {
+ $dataCenterHandsRequest = Transip_ColocationService::requestRemoteHands(
+ $coloName, $contactName, $phoneNumber, $expectedDuration, $instructions);
+ $result = 'The request has been sent.';
+ }
+ 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());
+ }
+}
+
+?>
+
+
+ TransIP API Datacenter Remote Hands Request
+
+
+
+
TransIP API Datacenter Remote Hands Request
+ =(isset($result)?'
'.$result.'
':'')?>
+ Fill out the form to create a remote hands request
+
+
+
+
+
diff --git a/examples/ColocationService-setReverseDns.php b/examples/ColocationService-setReverseDns.php
new file mode 100644
index 0000000..c2697ef
--- /dev/null
+++ b/examples/ColocationService-setReverseDns.php
@@ -0,0 +1,22 @@
+
+ */
+
+require_once('Transip/ColocationService.php');
+
+try
+{
+ // Change the reverse dns of an already active IPAddress assigned to the current user
+ // Please note that 127.0.0.1 is a example addresss
+ Transip_ColocationService::setReverseDns('127.0.0.1', 'reverse.example.com');
+}
+catch(Exception $e)
+{
+ print "error: {$e->getMessage()}\n";
+}
+?>
diff --git a/examples/DnsService-getDnsSecEntries.php b/examples/DnsService-getDnsSecEntries.php
new file mode 100644
index 0000000..57e5080
--- /dev/null
+++ b/examples/DnsService-getDnsSecEntries.php
@@ -0,0 +1,23 @@
+
+ */
+
+// Include dnsservice
+require_once('Transip/DnsService.php');
+
+$domainName = 'example.com';
+
+try {
+ // Get the dnssec entries from the transip system
+ $entries = Transip_DnsService::getDnsSecEntries($domainName);
+ var_dump($entries);
+} 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;
+}
diff --git a/examples/DnsService-setDnsEntries.php b/examples/DnsService-setDnsEntries.php
new file mode 100644
index 0000000..08097e2
--- /dev/null
+++ b/examples/DnsService-setDnsEntries.php
@@ -0,0 +1,30 @@
+
+ */
+
+// Include dnsservice
+require_once('Transip/DnsService.php');
+
+$domainName = 'example.com';
+
+// Create the dns entries we want
+$dnsEntries = [];
+$dnsEntries[] = new Transip_DnsEntry('@', 86400, Transip_DnsEntry::TYPE_A, '127.0.0.1');
+$dnsEntries[] = new Transip_DnsEntry('www', 86400, Transip_DnsEntry::TYPE_CNAME, '@');
+$dnsEntries[] = new Transip_DnsEntry('mail', 86400, Transip_DnsEntry::TYPE_CNAME, '@');
+$dnsEntries[] = new Transip_DnsEntry('@', 86400, Transip_DnsEntry::TYPE_MX, '10 mail.');
+
+try {
+ // Save the dns entries in the transip system
+ Transip_DnsService::setDnsEntries($domainName, $dnsEntries);
+ echo 'The DNS Entries have been saved.';
+} 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;
+}
diff --git a/examples/DnsService-setDnsSecEntries.php b/examples/DnsService-setDnsSecEntries.php
new file mode 100644
index 0000000..17c5833
--- /dev/null
+++ b/examples/DnsService-setDnsSecEntries.php
@@ -0,0 +1,49 @@
+
+ */
+
+// Include domainservice
+require_once('Transip/DnsService.php');
+
+$domainName = 'example.com';
+
+$keyTag = '';
+/**
+ * @var $flag
+ * @see Transip_DnsSecEntry::ALL_FLAGS
+ */
+$flag = '';
+/**
+ * @var $algorithm
+ * @see Transip_DnsSecEntry::ALL_ALGORITHMS
+ */
+$algorithm = '';
+$publicKey = '';
+
+if (!Transip_DnsService::canEditDnsSec($domainName)) {
+ die("Unable to update DNSSEC data.");
+}
+
+// Create the dnssec entries we want
+$dnsSecEntries = [];
+$dnsSecEntries[] = new Transip_DnsSecEntry(
+ $keyTag,
+ $flag,
+ $algorithm,
+ $publicKey
+);
+
+try {
+ // Save the dnssec entries in the transip system
+ Transip_DnsService::setDnsSecEntries($domainName, $dnsSecEntries);
+ echo 'The DNSSEC Entries have been saved.';
+} 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;
+}
diff --git a/examples/DomainService-batchCheckAvailability.php b/examples/DomainService-batchCheckAvailability.php
new file mode 100644
index 0000000..e8ae608
--- /dev/null
+++ b/examples/DomainService-batchCheckAvailability.php
@@ -0,0 +1,82 @@
+
+ */
+
+require_once('../Transip/DomainService.php');
+
+if(isset($_GET['domains']) && strlen($_GET['domains']) > 0)
+{
+ // seperate each line into a domain and trim off any whitespace
+ $domains = explode("\n", $_GET['domains']);
+ $domains = array_map('trim', $domains);
+ $result = '';
+
+ try
+ {
+ // Request the availability of multiple domains by using the Transip_DomainService API;
+ // we can get the following different statusses back with different meanings, wrapped in a Transip_DomainCheckResult.
+ $domainCheckResults = Transip_DomainService::batchCheckAvailability($domains);
+ foreach($domainCheckResults as $domainCheckResult)
+ {
+ switch($domainCheckResult->status)
+ {
+ case Transip_DomainService::AVAILABILITY_INYOURACCOUNT:
+ $result .= htmlspecialchars($domainCheckResult->domainName)
+ . ' is not available. ';
+ break;
+
+ case Transip_DomainService::AVAILABILITY_UNAVAILABLE:
+ $result .= htmlspecialchars($domainCheckResult->domainName)
+ . ' is not available for transfer. ';
+ break;
+
+ case Transip_DomainService::AVAILABILITY_FREE:
+ $result .= htmlspecialchars($domainCheckResult->domainName)
+ . ' is available for registration. ';
+ break;
+
+
+ case Transip_DomainService::AVAILABILITY_NOTFREE:
+ $result .= htmlspecialchars($domainCheckResult->domainName)
+ . ' is registered. If you are the owner,
+ you could transfer it. ';
+ 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.
+ $result = 'An error occurred: ' . htmlspecialchars($e->getMessage());
+ }
+}
+else
+{
+ $domains = array();
+ $result = '';
+}
+
+?>
+
+
+
+
+
+
TransIP API Batch DomainChecker Example
+ Fill in each domain on a seperate line. The maximum of domains is 20.
+
+
+
+
+
diff --git a/examples/DomainService-batchGetInfo.php b/examples/DomainService-batchGetInfo.php
new file mode 100644
index 0000000..b78068f
--- /dev/null
+++ b/examples/DomainService-batchGetInfo.php
@@ -0,0 +1,138 @@
+
+ */
+
+require_once('../Transip/DomainService.php');
+
+if(isset($_GET['domains']) && strlen($_GET['domains']) > 0)
+{
+ /** @var string[] $domainNames A list of domain names. */
+ $domainNames = explode("\n", $_GET['domains']);
+ $domainNames = array_filter($domainNames, 'trim');
+
+ try
+ {
+ // Request information about a domain in your account by using the TransIP
+ // DomainService API; A domain Object will be returned holding all
+ // information available about the domain.
+ $domains = Transip_DomainService::batchGetInfo($domainNames);
+
+ // INFO: A domain object holds all data directly available for a domain:
+ // + it has a list of nameservers,
+ // + a list of whois-contacts
+ // + a list of dns-entries if the domain is using TransIP nameservers
+ // + and, optionally, a Transip_DomainBranding object that holds
+ // information about branding (see reseller info for more)
+ //
+ // The domain object does not include registrar-lock and auth/epp-code
+ // information, since this information will always be fetched real-time
+ // from the registry. To get this information, you can use the
+ // getIsLocked() and getAuthCode API calls.
+
+
+ $result = "We got the following information about these domains:\n" .
+ htmlspecialchars(implode(",\n", $domainNames)) . "\n\n";
+ }
+ 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
+{
+ $domainNames = array();
+ $domains = array();
+ $result = '';
+}
+
+?>
+
+
+
+
+
+
TransIP API GetInfo Example
+Fill in each domain on a seperate line. The maximum of domains is 20.
+
+
+
+ if(!empty($domains)) {?>
+
+ foreach($domains as $domain) { ?>
+
+
=$domain->name?>
+
Nameservers
+
+
+ // iterate over each nameserver and output the hostname and optionally the glues
+ foreach($domain->nameservers as $ns)
+ {
+ echo "
+
+ // iterate over each dnsEntries and output it nicely
+ foreach($domain->dnsEntries as $dnsEntry)
+ {
+ echo "
";
+ echo "
" . htmlspecialchars($dnsEntry->name) . "
";
+ echo "
" . htmlspecialchars($dnsEntry->expire) . "
";
+ echo "
" . htmlspecialchars($dnsEntry->type) . "
";
+ echo "
" . htmlspecialchars($dnsEntry->content) . "
";
+
+ echo "
";
+ }
+ ?>
+
+
+ } ?>
+
+ } ?>
+
+
\ No newline at end of file
diff --git a/examples/DomainService-cancel.php b/examples/DomainService-cancel.php
new file mode 100644
index 0000000..6ffdded
--- /dev/null
+++ b/examples/DomainService-cancel.php
@@ -0,0 +1,57 @@
+
+ */
+
+require_once('Transip/DomainService.php');
+
+if(isset($_POST['domain']) && strlen($_POST['domain']) > 0)
+{
+ $domain = $_POST['domain'];
+ $when = isset($_POST['when']) && !empty($_POST['when']) ? $_POST['when'] : 'end';
+ try
+ {
+ // Request cancellation of a domain by using the Transip_DomainService API;
+ Transip_DomainService::cancel($domain, $when);
+ }
+ 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());
+ }
+}
+
+?>
+
+
+
+
+
+
TransIP API cancel Example
+ Fill in the domain you want to cancel.
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/DomainService-checkAvailability.php b/examples/DomainService-checkAvailability.php
new file mode 100644
index 0000000..e38bfec
--- /dev/null
+++ b/examples/DomainService-checkAvailability.php
@@ -0,0 +1,75 @@
+
+ */
+
+require_once('Transip/DomainService.php');
+
+if(isset($_GET['domain']) && strlen($_GET['domain']) > 0)
+{
+ $domain = $_GET['domain'];
+
+ 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_INYOURACCOUNT:
+ $result = htmlspecialchars($domain)
+ . ' is not available.';
+ break;
+
+ case Transip_DomainService::AVAILABILITY_UNAVAILABLE:
+ $result = htmlspecialchars($domain)
+ . ' is not available for transfer.';
+ break;
+
+ case Transip_DomainService::AVAILABILITY_FREE:
+ $result = htmlspecialchars($domain)
+ . ' is available for registration.';
+ break;
+
+
+ case Transip_DomainService::AVAILABILITY_NOTFREE:
+ $result = htmlspecialchars($domain)
+ . ' is registered. If you are the owner,
+ you could transfer it.';
+ 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.
+ $result = 'An error occurred: ' . htmlspecialchars($e->getMessage());
+ }
+}
+else
+{
+ $domain = '';
+ $result = '';
+}
+
+?>
+
+
+
+
+
+
TransIP API DomainChecker Example
+ Fill in the domain you want to check and press Check.
+
+
+
+
+
diff --git a/examples/DomainService-domainActions.php b/examples/DomainService-domainActions.php
new file mode 100644
index 0000000..e439764
--- /dev/null
+++ b/examples/DomainService-domainActions.php
@@ -0,0 +1,67 @@
+
+ */
+
+
+require_once('Transip/DomainService.php');
+
+try
+{
+ $currentDomainAction = Transip_DomainService::getCurrentDomainAction($domainName);
+
+ $result = '';
+ if(is_null($currentDomainAction))
+ {
+ // There is currently no action running on this domain
+ $result = "Currently no action for domain {$domainName}\n";
+ }
+
+ if($currentDomainAction->hasFailed !== true)
+ {
+ // There is currently an action running, and it has not failed yet.
+ $result = "Current action for domain is {$currentDomainAction->name}\n";
+ }
+ else
+ {
+ // There was an action running on the domain, and it has failed.
+ // We retry with new nameservers for the domain.
+ $result = "Current action for domain is {$currentDomainAction->name} and has failed with message {$currentDomainAction->message}\n";
+ $result .= "Retrying....\n";
+
+ $domain = Transip_DomainService::getInfo($domainName);
+
+ // Create new nameserver entries we want
+ $nameservers = array();
+ $nameservers[] = new Transip_Nameserver('ns1.mydomain.com');
+ $nameservers[] = new Transip_Nameserver('ns2.mydomain.com', '');
+ // Since ns.thedomaintomodify.com is a subdomain of the domain we are saving,
+ // the nameserver needs a glue record (ipv4 required, ipv6 optional)
+ $nameservers[] = new Transip_Nameserver('ns.thedomaintomodify.com', '99.99.99.99');
+ $domain->nameServers = $nameServers;
+
+ // We try the current action again, but now with our modified Transip_Domain object.
+ // Based on the error message one should modify the appropiate part of this object
+ Transip_DomainService::retryCurrentDomainActionWithNewData($domain);
+
+ // If you need to change the authcode, please use the call below
+ // Transip_DomainService::retryTransferWithDifferentAuthCode($domain, $newAuthCode);
+
+ // If you want to cancel the action use
+ // Beware, all changes will be rollbacked.
+ // Transip_DomainService::cancelDomainAction($domain)
+ }
+
+ echo $result;
+}
+catch(Exception $exception)
+{
+ // When something goes wrong, an Exception will be thrown with relevant information.
+ echo "An Exception occured. Code: {$exception->getCode()}, message: {$exception->getMessage()}\n";
+}
+?>
diff --git a/examples/DomainService-getAllTldInfos.php b/examples/DomainService-getAllTldInfos.php
new file mode 100644
index 0000000..006045e
--- /dev/null
+++ b/examples/DomainService-getAllTldInfos.php
@@ -0,0 +1,30 @@
+
+ */
+
+
+// Include domainservice
+require_once('Transip/DomainService.php');
+
+try
+{
+ // Call the API, the result will be an array of all Tlds
+ $tldList = Transip_DomainService::getAllTldInfos();
+
+ // Output the Tlds
+ print_r($tldList);
+}
+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;
+}
+
+?>
diff --git a/examples/DomainService-getAuthCode.php b/examples/DomainService-getAuthCode.php
new file mode 100644
index 0000000..ff804f9
--- /dev/null
+++ b/examples/DomainService-getAuthCode.php
@@ -0,0 +1,62 @@
+
+ */
+
+
+require_once('Transip/DomainService.php');
+
+if(isset($_GET['domain']) && strlen($_GET['domain']) > 0)
+{
+ $domain = $_GET['domain'];
+
+ try
+ {
+ // Request the authcode of a domain by using the Transip_DomainService API;
+ $info = Transip_DomainService::getInfo($domain);
+ if($info != null)
+ {
+ $authCode = $info->authCode;
+ }
+ else
+ {
+ $authCode = 'unknown';
+ }
+
+ $result = 'The authcode for the domain ' . htmlspecialchars($domain)
+ . ' is: ' . htmlspecialchars($authCode);
+ }
+ 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.
+ $whois = 'An error occurred: ' . htmlspecialchars($e->getMessage());
+ }
+}
+else
+{
+ $domain = '';
+ $result = '';
+}
+
+?>
+
+
+
+
+
+
TransIP API GetAuthCode Example
+ Fill in the domain you want to get the authcode for and click on Get AuthCode.
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/DomainService-getDomainNames.php b/examples/DomainService-getDomainNames.php
new file mode 100644
index 0000000..d11ddef
--- /dev/null
+++ b/examples/DomainService-getDomainNames.php
@@ -0,0 +1,32 @@
+
+ */
+
+
+// Include domainservice
+require_once('Transip/DomainService.php');
+
+// Set the result variable
+$domainList = array();
+
+try
+{
+ // Call the API, the result will be an array of all your domain names
+ $domainList = Transip_DomainService::getDomainNames();
+
+ // Output the domain names
+ print_r($domainList);
+}
+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;
+}
+
+?>
diff --git a/examples/DomainService-getInfo.php b/examples/DomainService-getInfo.php
new file mode 100644
index 0000000..2db9e80
--- /dev/null
+++ b/examples/DomainService-getInfo.php
@@ -0,0 +1,130 @@
+
+ */
+
+require_once('Transip/DomainService.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
+ // DomainService API; A domain Object will be returned holding all
+ // information available about the domain.
+ $domain = Transip_DomainService::getInfo($domainName);
+
+ // INFO: A domain object holds all data directly available for a domain:
+ // + it has a list of nameservers,
+ // + a list of whois-contacts
+ // + a list of dns-entries if the domain is using TransIP nameservers
+ // + and, optionally, a Transip_DomainBranding object that holds
+ // information about branding (see reseller info for more)
+ //
+ // The domain object does not include registrar-lock and auth/epp-code
+ // information, since this information will always be fetched real-time
+ // from the registry. To get this information, you can use the
+ // getIsLocked() and getAuthCode API calls.
+
+
+ $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 = '';
+ $domain = null;
+ $result = '';
+}
+
+?>
+
+
+
+
+
+
TransIP API GetInfo Example
+ Fill in the domain you want to get information about and click on Get Info.
+
+
+
+ if(isset($domain)) {?>
+
+
Nameservers
+
+
+ // iterate over each nameserver and output the hostname and optionally the glues
+ foreach($domain->nameservers as $ns)
+ {
+ echo "
+
+ // iterate over each dnsEntries and output it nicely
+ foreach($domain->dnsEntries as $dnsEntry)
+ {
+ echo "
";
+ echo "
" . htmlspecialchars($dnsEntry->name) . "
";
+ echo "
" . htmlspecialchars($dnsEntry->expire) . "
";
+ echo "
" . htmlspecialchars($dnsEntry->type) . "
";
+ echo "
" . htmlspecialchars($dnsEntry->content) . "
";
+
+ echo "
";
+ }
+ ?>
+
+ }?>
+
+
\ No newline at end of file
diff --git a/examples/DomainService-getWhois.php b/examples/DomainService-getWhois.php
new file mode 100644
index 0000000..cfbee3f
--- /dev/null
+++ b/examples/DomainService-getWhois.php
@@ -0,0 +1,51 @@
+
+ */
+
+require_once('Transip/DomainService.php');
+
+
+if(isset($_GET['domain']) && strlen($_GET['domain']) > 0)
+{
+ $domain = $_GET['domain'];
+
+ try
+ {
+ // Request the WHOIS information of a domain by using the Transip_DomainService API.
+ $whois = Transip_DomainService::getWhois($domain);
+ }
+ 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.
+ $whois = 'An error occurred: ' . htmlspecialchars($e->getMessage());
+ }
+}
+else
+{
+ $domain = '';
+ $whois = '';
+}
+
+?>
+
+
+
+
+
+
TransIP API Whois Example
+ Fill in the domain you want to get the whois for and click on Get Whois.
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/DomainService-register-dns.php b/examples/DomainService-register-dns.php
new file mode 100644
index 0000000..db7b1fa
--- /dev/null
+++ b/examples/DomainService-register-dns.php
@@ -0,0 +1,37 @@
+
+ */
+
+// 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);
+ $propositionNumber = Transip_DomainService::register($domain);
+ echo 'The domain ' . $domain->name . ' has been requested with proposition number ' . $propositionNumber;
+}
+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;
+}
+
+?>
\ No newline at end of file
diff --git a/examples/DomainService-register-nameserver.php b/examples/DomainService-register-nameserver.php
new file mode 100644
index 0000000..95a5601
--- /dev/null
+++ b/examples/DomainService-register-nameserver.php
@@ -0,0 +1,43 @@
+
+ */
+
+
+try
+{
+ // Include domainservice
+ require_once('Transip/DomainService.php');
+
+ // setting nameservers can be done in a few ways
+ // default nameservers require only the hostname
+ $nameservers[] = new Transip_Nameserver('ns1.transip.nl');
+
+ // if the hostname is a subdomain of the domain we are setting the nameservers
+ // for, a gluerecord is required. ipv4 is required, ipv6 is optional.
+
+ // without ipv6
+ $nameservers[] = new Transip_Nameserver('ns1.yourdomain.com', '127.0.0.1');
+
+ // with ipv6 (both adresses point to localhost)
+ $nameservers[] = new Transip_Nameserver('ns2.yourdomain.com', '127.0.0.1', '::1');
+
+ // you can now use the $nameservers array as the second parameter when instantiating
+ // a new Transip_Domain. For example:
+ $domain = new Transip_Domain('example.com', $nameservers);
+ $propositionNumber = Transip_DomainService::register($domain);
+ echo 'The domain ' . $domain->name . ' has been requested with proposition number ' . $propositionNumber;
+}
+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;
+}
+
+
+?>
\ No newline at end of file
diff --git a/examples/DomainService-register-whois.php b/examples/DomainService-register-whois.php
new file mode 100644
index 0000000..5f7782c
--- /dev/null
+++ b/examples/DomainService-register-whois.php
@@ -0,0 +1,59 @@
+
+ */
+
+// Include domainservice
+require_once('Transip/DomainService.php');
+
+
+try
+{
+ $types = array(
+ Transip_WhoisContact::TYPE_REGISTRANT,
+ Transip_WhoisContact::TYPE_ADMINISTRATIVE,
+ Transip_WhoisContact::TYPE_TECHNICAL
+ );
+
+ // setting up whois records is quite easy
+ $contacts = array();
+ foreach($types AS $type)
+ {
+ $contact = new Transip_WhoisContact();
+ $contact->type = $type;
+ // please note that 'Sjaak de Waal' is a fictional character
+ // any resemblances to real persons are unintentional and coincidential
+ // Also, please note that the middleName field is not used, so you should
+ // put any middleName/infix in the lastName field.
+ $contact->firstName = 'Sjaak';
+ $contact->lastName = 'de Waal';
+ $contact->companyName = 'TransIP';
+ $contact->companyKvk = '24345899';
+ $contact->companyType = 'BV';
+ $contact->street = 'Schipholweg';
+ $contact->number = '11e';
+ $contact->postalCode = '2316XB';
+ $contact->city = 'Leiden';
+ $contact->phoneNumber = '+31715241919';
+ $contact->faxNumber = '+31715241918';
+ $contact->email = 'support@transip.nl';
+ $contact->country = 'NL';
+ $contacts[] = $contact;
+ }
+
+ // you can now use the $contacts array as the third parameter when instantiating
+ // a new Transip_Domain. For example:
+ $domain = new Transip_Domain($name, $nameservers, $contacts, $dnsEntries, $branding);
+ Transip_DomainService::register($domain);
+}
+catch(Exception $e)
+{
+ echo 'An error occured: '. $e->getMessage(), PHP_EOL;
+}
+
+
+?>
diff --git a/examples/DomainService-register.php b/examples/DomainService-register.php
new file mode 100644
index 0000000..39cbfc0
--- /dev/null
+++ b/examples/DomainService-register.php
@@ -0,0 +1,24 @@
+, ,
+ // );
+ $domain = new Transip_Domain('transip.nl');
+ $propositionNumber = Transip_DomainService::register($domain);
+ echo 'The domain ' . $domain->name . ' has been requested with proposition number ' . $propositionNumber;
+}
+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 occured: '. $e->getMessage(), PHP_EOL;
+}
+
+?>
\ No newline at end of file
diff --git a/examples/DomainService-setContacts.php b/examples/DomainService-setContacts.php
new file mode 100644
index 0000000..f4417db
--- /dev/null
+++ b/examples/DomainService-setContacts.php
@@ -0,0 +1,255 @@
+
+ */
+
+require_once('Transip/DomainService.php');
+
+// Maintain a list of all possible contact types
+$contactTypes = array(
+ Transip_WhoisContact::TYPE_REGISTRANT,
+ Transip_WhoisContact::TYPE_ADMINISTRATIVE,
+ Transip_WhoisContact::TYPE_TECHNICAL);
+$contacts = null;
+
+if(isset($_REQUEST['domain']) && strlen($_REQUEST['domain']) > 0)
+{
+ $domain = $_REQUEST['domain'];
+
+ try
+ {
+ // Check to see if we an action was requested and if so, do it
+ if(isset($_POST['setContacts']))
+ {
+ // Construct an array to hold Transip_WhoisContact objects for all contact types
+ $newContacts = array();
+ foreach($contactTypes as $type)
+ {
+ // Construct a new Transip_WhoisContact object
+ $newContact = new Transip_WhoisContact();
+ $newContact->type = $type;
+ $newContact->firstName = $_POST[$type]['firstName'];
+ $newContact->middleName = $_POST[$type]['middleName'];
+ $newContact->lastName = $_POST[$type]['lastName'];
+ $newContact->companyName = $_POST[$type]['companyName'];
+ $newContact->companyKvk = $_POST[$type]['companyKvk'];
+ $newContact->companyType = $_POST[$type]['companyType'];
+ $newContact->street = $_POST[$type]['street'];
+ $newContact->number = $_POST[$type]['number'];
+ $newContact->postalCode = $_POST[$type]['postalCode'];
+ $newContact->city = $_POST[$type]['city'];
+ $newContact->country = $_POST[$type]['country'];
+ $newContact->phoneNumber = $_POST[$type]['phoneNumber'];
+ $newContact->faxNumber = $_POST[$type]['faxNumber'];
+ $newContact->email = $_POST[$type]['email'];
+
+ // Add new contact to the list
+ $newContacts[] = $newContact;
+ }
+
+ // Set contacts for the domain by using the Transip_DomainService API;
+ Transip_DomainService::setContacts($domain, $newContacts);
+ }
+
+ // Request the locked status of a domain by using the Transip_DomainService API;
+ $info = Transip_DomainService::getInfo($domain);
+
+ // The Transip_Domain object contains an array of Transip_WhoisContact objects
+ // Each Transip_WhoisContact object has one of three types
+ // Iterate through contacts and save in array
+ foreach($info->contacts as $contact)
+ {
+ $contacts[$contact->type] = $contact;
+ }
+ }
+ 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.
+ $error = 'An error occurred: ' . htmlspecialchars($e->getMessage());
+ }
+}
+else
+{
+ $domain = '';
+ $isLocked = false;
+}
+
+?>
+
+
+
+
+
+
TransIP API Set Contacts Example
+ Fill in the domain you want to set the owner for and click on Get Owner.
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/DomainService-setLock.php b/examples/DomainService-setLock.php
new file mode 100644
index 0000000..f0a5afd
--- /dev/null
+++ b/examples/DomainService-setLock.php
@@ -0,0 +1,85 @@
+
+ */
+
+require_once('Transip/DomainService.php');
+
+if(isset($_REQUEST['domain']) && strlen($_REQUEST['domain']) > 0)
+{
+ $domain = $_REQUEST['domain'];
+
+ try
+ {
+ // Check to see if we an action was requested and if so, do it
+ if(isset($_POST['lock']))
+ {
+ // Lock the domain by using the Transip_DomainService API;
+ $isLocked = Transip_DomainService::setLock($domain);
+ }
+
+ if(isset($_POST['unlock']))
+ {
+ // Unlock the domain by using the Transip_DomainService API;
+ $isLocked = Transip_DomainService::unsetLock($domain);
+ }
+
+ // Request the locked status of a domain by using the Transip_DomainService API;
+ $isLocked = Transip_DomainService::getIsLocked($domain);
+ }
+ 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.
+ $whois = 'An error occurred: ' . htmlspecialchars($e->getMessage());
+ }
+}
+else
+{
+ $domain = '';
+ $isLocked = false;
+}
+
+?>
+
+
+
+
+
+
TransIP API Locking Example
+ Fill in the domain you want to get the authcode for and click on Get LockStatus.
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/DomainService-setNameservers.php b/examples/DomainService-setNameservers.php
new file mode 100644
index 0000000..ed41fe2
--- /dev/null
+++ b/examples/DomainService-setNameservers.php
@@ -0,0 +1,33 @@
+
+ */
+
+// Include domainservice
+require_once('Transip/DomainService.php');
+
+// Create the nameserver entries we want
+$nameservers = array();
+$nameservers[] = new Transip_Nameserver('ns1.example.com');
+$nameservers[] = new Transip_Nameserver('ns2.example.com', '');
+// Since ns.thedomaintomodify.com is a subdomain of the domain we are saving,
+// the nameserver needs a glue record (ipv4 required, ipv6 optional)
+$nameservers[] = new Transip_Nameserver('ns.example.com', '99.99.99.99');
+
+try
+{
+ // Save the nameservers in the transip system
+ Transip_DomainService::setNameservers('example.com', $nameservers);
+ echo 'The nameservers have been saved.';
+}
+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;
+}
+?>
diff --git a/examples/DomainService-setOwner.php b/examples/DomainService-setOwner.php
new file mode 100644
index 0000000..1120254
--- /dev/null
+++ b/examples/DomainService-setOwner.php
@@ -0,0 +1,185 @@
+
+ */
+
+require_once('Transip/DomainService.php');
+
+$owner = null;
+if(isset($_REQUEST['domain']) && strlen($_REQUEST['domain']) > 0)
+{
+ $domain = $_REQUEST['domain'];
+
+ try
+ {
+ // Check to see if we an action was requested and if so, do it
+ if(isset($_POST['setOwner']))
+ {
+ // Construct a new WhoisContact object
+ $newOwner = new Transip_WhoisContact();
+ $newOwner->type = Transip_WhoisContact::TYPE_REGISTRANT;
+ $newOwner->firstName = $_POST['firstName'];
+ $newOwner->middleName = $_POST['middleName'];
+ $newOwner->lastName = $_POST['lastName'];
+ $newOwner->companyName = $_POST['companyName'];
+ $newOwner->companyKvk = $_POST['companyKvk'];
+ $newOwner->companyType = $_POST['companyType'];
+ $newOwner->street = $_POST['street'];
+ $newOwner->number = $_POST['number'];
+ $newOwner->postalCode = $_POST['postalCode'];
+ $newOwner->city = $_POST['city'];
+ $newOwner->country = $_POST['country'];
+ $newOwner->phoneNumber = $_POST['phoneNumber'];
+ $newOwner->faxNumber = $_POST['faxNumber'];
+ $newOwner->email = $_POST['email'];
+
+ // Set owner for the domain by using the Transip_DomainService API;
+ Transip_DomainService::setOwner($domain, $newOwner);
+ }
+
+ // Request the locked status of a domain by using the Transip_DomainService API;
+ $info = Transip_DomainService::getInfo($domain);
+
+ // The Domain object contains an array of WhoisContact objects
+ // Each WhoisContact object has one of three types
+ // Iterate through contacts to find registrant (owner)
+ foreach($info->contacts as $contact)
+ {
+ if ($contact->type == Transip_WhoisContact::TYPE_REGISTRANT )
+ {
+ $owner = $contact;
+ 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.
+ $error = 'An error occurred: ' . htmlspecialchars($e->getMessage());
+ }
+}
+else
+{
+ $domain = '';
+ $isLocked = false;
+}
+
+?>
+
+
+
+
+
+
TransIP API Set Owner Example
+ Fill in the domain you want to set the owner for and click on Get Owner.
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/DomainService-transfer.php b/examples/DomainService-transfer.php
new file mode 100644
index 0000000..bc42641
--- /dev/null
+++ b/examples/DomainService-transfer.php
@@ -0,0 +1,57 @@
+
+ */
+
+
+// Include domainservice
+require_once('Transip/DomainService.php');
+
+try
+{
+ // Transfers a domain with your default settings
+ // It's also possible to transfer with custom settings,
+ // for this the call should be like:
+ // $domain = new Transip_Domain('transip.nl', , ,
+ // );
+
+ $domainName = 'example.com';
+ $authCode = '[AUTHCODE]';
+
+
+ $domain = new Transip_Domain($domainName);
+
+ $tldName = strstr($domainName, '.');
+ $tldInfo = Transip_DomainService::getTldInfo($tldName);
+ if(in_array(Transip_Tld::CAPABILITY_CANTRANSFERWITHOWNERCHANGE, $tldInfo->capabilities))
+ {
+ Transip_DomainService::transferWithOwnerChange($domain, $authCode);
+ }
+ elseif(in_array(Transip_Tld::CAPABILITY_CANTRANSFERWITHOUTOWNERCHANGE, $tldInfo->capabilities))
+ {
+ Transip_DomainService::transferWithoutOwnerChange($domain, $authCode);
+ }
+ else
+ {
+ // The TLD does not support transfers at all
+ throw new Exception('TLD ' . $tldName . ' does not support domain transfers');
+ }
+
+ 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: ' . htmlspecialchars($f->getMessage());
+}
+catch(Exception $e)
+{
+ echo htmlspecialchars($e->getMessage());
+}
+
+?>
diff --git a/examples/ForwardService-order.php b/examples/ForwardService-order.php
new file mode 100644
index 0000000..b83358b
--- /dev/null
+++ b/examples/ForwardService-order.php
@@ -0,0 +1,30 @@
+
+ */
+
+// Include forwardservice
+require_once('Transip/ForwardService.php');
+
+// Order a forward service for a domain name
+try
+{
+ // Create a new forward object that directly forwards to example.org.
+ $forward = new Transip_Forward();
+ $forward->domainName = 'example.com';
+ $forward->forwardTo = 'http://www.example.org';
+ $forward->forwardEmailTo = 'test@example.com';
+ // Order the forward
+ Transip_ForwardService::order($forward);
+}
+catch(Exception $exception)
+{
+ // When something goes wrong, an Exception will be thrown with relevant information.
+ echo "An Exception occured. Code: {$exception->getCode()}, message: {$exception->getMessage()}\n";
+}
+
+?>
diff --git a/examples/HaipService-addCertificateToHaip.php b/examples/HaipService-addCertificateToHaip.php
new file mode 100644
index 0000000..f171edc
--- /dev/null
+++ b/examples/HaipService-addCertificateToHaip.php
@@ -0,0 +1,20 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // Aad certificate to haip by haip name and certificate id
+ Transip_HaipService::addCertificateToHaip('example-haip', 1);
+} 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;
+}
diff --git a/examples/HaipService-addHaipPortConfiguration.php b/examples/HaipService-addHaipPortConfiguration.php
new file mode 100644
index 0000000..f1cc341
--- /dev/null
+++ b/examples/HaipService-addHaipPortConfiguration.php
@@ -0,0 +1,24 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // Add configuration by HA-IP name
+ // mode ('tcp','http','https','proxy')
+ Transip_HaipService::addHaipPortConfiguration('example-haip', 'HTTP', 80, 'http');
+
+} 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;
+}
diff --git a/examples/HaipService-addPortConfiguration.php b/examples/HaipService-addPortConfiguration.php
new file mode 100644
index 0000000..0344168
--- /dev/null
+++ b/examples/HaipService-addPortConfiguration.php
@@ -0,0 +1,23 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // Add configuration by HA-IP name
+ // mode ('tcp','http','https','proxy')
+ // endpointSslMode ('off','on','strict')
+ Transip_HaipService::addPortConfiguration('example-haip', 'HTTP', 80, 80, 'http', 'off');
+
+} 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;
+}
diff --git a/examples/HaipService-cancelHaip.php b/examples/HaipService-cancelHaip.php
new file mode 100644
index 0000000..6dca250
--- /dev/null
+++ b/examples/HaipService-cancelHaip.php
@@ -0,0 +1,23 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // Cancel your haip by name at end of contract, use
+ // end-time is either: 'immediately' or 'end' (end means end of contract)
+ $haip = Transip_HaipService::cancelHaip('example-haip', 'end');
+
+ print_r($haip);
+} 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;
+}
diff --git a/examples/HaipService-changeHaipVps.php b/examples/HaipService-changeHaipVps.php
new file mode 100644
index 0000000..f8e8f04
--- /dev/null
+++ b/examples/HaipService-changeHaipVps.php
@@ -0,0 +1,20 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // Change the attached Vps of the HA-IP
+ Transip_HaipService::changeHaipVps('example-haip', 'example-vps');
+} 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;
+}
diff --git a/examples/HaipService-deleteCertificateFromHaip.php b/examples/HaipService-deleteCertificateFromHaip.php
new file mode 100644
index 0000000..6bc8282
--- /dev/null
+++ b/examples/HaipService-deleteCertificateFromHaip.php
@@ -0,0 +1,21 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // Remove certificate by HA-IP name and certificate id
+ Transip_HaipService::deleteCertificateFromHaip('example-haip', 1);
+
+} 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;
+}
diff --git a/examples/HaipService-deleteHaipPortConfiguration.php b/examples/HaipService-deleteHaipPortConfiguration.php
new file mode 100644
index 0000000..8ca1680
--- /dev/null
+++ b/examples/HaipService-deleteHaipPortConfiguration.php
@@ -0,0 +1,24 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // Remove a port configuration by HA-IP name and port config id
+ $haip = Transip_HaipService::deleteHaipPortConfiguration('example-haip', 1);
+
+ print_r($haip);
+} 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;
+}
diff --git a/examples/HaipService-deletePortConfiguration.php b/examples/HaipService-deletePortConfiguration.php
new file mode 100644
index 0000000..221a8db
--- /dev/null
+++ b/examples/HaipService-deletePortConfiguration.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // Remove a port configuration by HA-IP name and port config id
+ $haip = Transip_HaipService::deletePortConfiguration('example-haip', 1);
+
+ print_r($haip);
+} 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;
+}
diff --git a/examples/HaipService-getAvailableCertificatesByHaip.php b/examples/HaipService-getAvailableCertificatesByHaip.php
new file mode 100644
index 0000000..e76339b
--- /dev/null
+++ b/examples/HaipService-getAvailableCertificatesByHaip.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // Get a haip available certificates by name
+ $haip = Transip_HaipService::getAvailableCertificatesByHaip('example-haip');
+
+ print_r($haip);
+} 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;
+}
diff --git a/examples/HaipService-getCertificatesByHaip.php b/examples/HaipService-getCertificatesByHaip.php
new file mode 100644
index 0000000..2b3eb29
--- /dev/null
+++ b/examples/HaipService-getCertificatesByHaip.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // Get haip certificates by haip name
+ $haip = Transip_HaipService::getCertificatesByHaip('example-haip');
+
+ print_r($haip);
+} 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;
+}
diff --git a/examples/HaipService-getHaip.php b/examples/HaipService-getHaip.php
new file mode 100644
index 0000000..7bd7b0c
--- /dev/null
+++ b/examples/HaipService-getHaip.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // Get a haip by name
+ $haip = Transip_HaipService::getHaip('example-haip');
+
+ print_r($haip);
+} 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;
+}
diff --git a/examples/HaipService-getHaipPortConfigurations.php b/examples/HaipService-getHaipPortConfigurations.php
new file mode 100644
index 0000000..7deae05
--- /dev/null
+++ b/examples/HaipService-getHaipPortConfigurations.php
@@ -0,0 +1,24 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // Get all port configuration by HA-IP name
+ $haip = Transip_HaipService::getHaipPortConfigurations('example-haip');
+
+ print_r($haip);
+} 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;
+}
diff --git a/examples/HaipService-getHaips.php b/examples/HaipService-getHaips.php
new file mode 100644
index 0000000..b937a59
--- /dev/null
+++ b/examples/HaipService-getHaips.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // Get a list of all Haip objects
+ $haipList = Transip_HaipService::getHaips();
+
+ print_r($haipList);
+} 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;
+}
diff --git a/examples/HaipService-getPortConfigurations.php b/examples/HaipService-getPortConfigurations.php
new file mode 100644
index 0000000..29410f2
--- /dev/null
+++ b/examples/HaipService-getPortConfigurations.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // Get all port configuration by HA-IP name
+ $haip = Transip_HaipService::getPortConfigurations('example-haip');
+
+ print_r($haip);
+} 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;
+}
diff --git a/examples/HaipService-getPtrForHaip.php b/examples/HaipService-getPtrForHaip.php
new file mode 100644
index 0000000..332828e
--- /dev/null
+++ b/examples/HaipService-getPtrForHaip.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // Get PTR's for Haip
+ $ptrs = Transip_HaipService::getPtrForHaip('example-haip');
+
+ print_r($ptrs);
+} 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;
+}
diff --git a/examples/HaipService-getStatusReport.php b/examples/HaipService-getStatusReport.php
new file mode 100644
index 0000000..5e13a79
--- /dev/null
+++ b/examples/HaipService-getStatusReport.php
@@ -0,0 +1,20 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // Retrieve status report data for a HA-IP as an array
+ $statusReport = Transip_HaipService::getStatusReport('example-haip');
+} 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;
+}
diff --git a/examples/HaipService-setBalancingMode.php b/examples/HaipService-setBalancingMode.php
new file mode 100644
index 0000000..36152bd
--- /dev/null
+++ b/examples/HaipService-setBalancingMode.php
@@ -0,0 +1,31 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // Change the HA-IP balancing mode to 'cookie', and pin sessions on the PHPSESSID cookie
+ Transip_HaipService::setBalancingMode('example-haip', 'cookie', 'PHPSESSID');
+
+ // ...
+
+ // Change the HA-IP balancing mode to 'roundrobin' (this is the default mode)
+ Transip_HaipService::setBalancingMode('example-haip', 'roundrobin', '');
+
+ // ...
+
+ // Change the HA-IP balancing mode to 'source'
+ Transip_HaipService::setBalancingMode('example-haip', 'source', '');
+
+} 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;
+}
diff --git a/examples/HaipService-setDefaultPortConfiguration.php b/examples/HaipService-setDefaultPortConfiguration.php
new file mode 100644
index 0000000..a219d62
--- /dev/null
+++ b/examples/HaipService-setDefaultPortConfiguration.php
@@ -0,0 +1,21 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // set dafault port configuration by haip name
+ Transip_HaipService::setDefaultPortConfiguration('example-haip');
+
+} 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;
+}
diff --git a/examples/HaipService-setHaipDescription.php b/examples/HaipService-setHaipDescription.php
new file mode 100644
index 0000000..41d0183
--- /dev/null
+++ b/examples/HaipService-setHaipDescription.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // set description by HA-IP name
+ $haip = Transip_HaipService::setHaipDescription('example-haip', 'example.com-haip');
+
+ print_r($haip);
+} 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;
+}
diff --git a/examples/HaipService-setHaipVpses.php b/examples/HaipService-setHaipVpses.php
new file mode 100644
index 0000000..c1efc18
--- /dev/null
+++ b/examples/HaipService-setHaipVpses.php
@@ -0,0 +1,20 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // Replaces currently attached VPSes to the HA-IP with the provided list of VPSes
+ Transip_HaipService::setHaipVpses('example-haip', ['example-vps1', 'example-vps2']);
+} 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;
+}
diff --git a/examples/HaipService-setHttpHealthCheck.php b/examples/HaipService-setHttpHealthCheck.php
new file mode 100644
index 0000000..11d30e9
--- /dev/null
+++ b/examples/HaipService-setHttpHealthCheck.php
@@ -0,0 +1,20 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // Configure a HTTP health check for the HA-IP that will access '/health.php' on port 80
+ Transip_HaipService::setHttpHealthCheck('example-haip', '/health.php', 80);
+} 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;
+}
diff --git a/examples/HaipService-setIpSetup.php b/examples/HaipService-setIpSetup.php
new file mode 100644
index 0000000..c9f187a
--- /dev/null
+++ b/examples/HaipService-setIpSetup.php
@@ -0,0 +1,31 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // Enable both IPv4 and IPv6 for the HA-IP
+ Transip_HaipService::setIpSetup('example-haip', 'both');
+
+ // ...
+
+ // Disable IPv6 for the HA-IP
+ Transip_HaipService::setIpSetup('example-haip', 'noipv6');
+
+ // ...
+
+ // Forward all IPv6 for the HA-IP to the IPv4 address on the VPS
+ Transip_HaipService::setIpSetup('example-haip', 'ipv6to4');
+
+} 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;
+}
diff --git a/examples/HaipService-setPtrForHaip.php b/examples/HaipService-setPtrForHaip.php
new file mode 100644
index 0000000..eb8c20b
--- /dev/null
+++ b/examples/HaipService-setPtrForHaip.php
@@ -0,0 +1,21 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // Set a ptr by HA-IP name
+ Transip_HaipService::setPtrForHaip('example-haip', 'example.com');
+
+} 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;
+}
diff --git a/examples/HaipService-setTcpHealthCheck.php b/examples/HaipService-setTcpHealthCheck.php
new file mode 100644
index 0000000..708f035
--- /dev/null
+++ b/examples/HaipService-setTcpHealthCheck.php
@@ -0,0 +1,20 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // Configure the health check for the HA-IP to use TCP. This will disable a configured HTTP health check.
+ Transip_HaipService::setTcpHealthCheck('example-haip');
+} 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;
+}
diff --git a/examples/HaipService-startHaipLetsEncryptCertificateIssue.php b/examples/HaipService-startHaipLetsEncryptCertificateIssue.php
new file mode 100644
index 0000000..70d9ecc
--- /dev/null
+++ b/examples/HaipService-startHaipLetsEncryptCertificateIssue.php
@@ -0,0 +1,21 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // issue a letsEncrypt certificate by HA-IP name and common Name
+ Transip_HaipService::startHaipLetsEncryptCertificateIssue('example-haip', 'commonName');
+
+} 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;
+}
diff --git a/examples/HaipService-updateHaipPortConfiguration.php b/examples/HaipService-updateHaipPortConfiguration.php
new file mode 100644
index 0000000..0beccdf
--- /dev/null
+++ b/examples/HaipService-updateHaipPortConfiguration.php
@@ -0,0 +1,26 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // Update the HA-IP port configuration by haip name and port configuration id
+ // mode ('tcp','http','https','proxy')
+ // endpointSslMode ('off','on','strict')
+ $haip = Transip_HaipService::updateHaipPortConfiguration('example-haip', 1, 'HTTP', 80, 'http');
+
+ print_r($haip);
+} 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;
+}
diff --git a/examples/HaipService-updatePortConfiguration.php b/examples/HaipService-updatePortConfiguration.php
new file mode 100644
index 0000000..16e0337
--- /dev/null
+++ b/examples/HaipService-updatePortConfiguration.php
@@ -0,0 +1,24 @@
+
+ */
+
+// Include haipservice
+require_once('Transip/HaipService.php');
+
+try {
+ // Update the HA-IP port configuration by haip name and port configuration id
+ // mode ('tcp','http','https','proxy')
+ // endpointSslMode ('off','on','strict')
+ $haip = Transip_HaipService::updatePortConfiguration('example-haip', 1, 'HTTP', 80, 80, 'http', 'off');
+
+ print_r($haip);
+} 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;
+}
diff --git a/examples/PropositionService-getPropositionStatus.php b/examples/PropositionService-getPropositionStatus.php
new file mode 100644
index 0000000..9563ede
--- /dev/null
+++ b/examples/PropositionService-getPropositionStatus.php
@@ -0,0 +1,21 @@
+getMessage(), PHP_EOL;
+}
+
+?>
\ No newline at end of file
diff --git a/examples/VpsService-addIpv6ToVps.php b/examples/VpsService-addIpv6ToVps.php
new file mode 100644
index 0000000..aaed3bf
--- /dev/null
+++ b/examples/VpsService-addIpv6ToVps.php
@@ -0,0 +1,21 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // add ipv6 to specific VPS (Ipv6 has to be in you Ipv6 Range)
+ Transip_VpsService::addIpv6ToVps('vps-name','ipv6-address');
+ echo 'added ipv6 to Vps';
+} 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;
+}
diff --git a/examples/VpsService-addVpsToPrivateNetwork.php b/examples/VpsService-addVpsToPrivateNetwork.php
new file mode 100644
index 0000000..f966d33
--- /dev/null
+++ b/examples/VpsService-addVpsToPrivateNetwork.php
@@ -0,0 +1,21 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // add the VPS to private network
+ Transip_VpsService::addVpsToPrivateNetwork('vps-name','private-network-name');
+ echo 'added Vps to private network';
+} 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;
+}
\ No newline at end of file
diff --git a/examples/VpsService-cancelAddon.php b/examples/VpsService-cancelAddon.php
new file mode 100644
index 0000000..79d0a06
--- /dev/null
+++ b/examples/VpsService-cancelAddon.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // cancel the addon for specific VPS
+ Transip_VpsService::cancelAddon('vps-name','addon-name');
+ echo 'Cancelled addon';
+} 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;
+}
\ No newline at end of file
diff --git a/examples/VpsService-cancelPrivateNetwork.php b/examples/VpsService-cancelPrivateNetwork.php
new file mode 100644
index 0000000..21b11bc
--- /dev/null
+++ b/examples/VpsService-cancelPrivateNetwork.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // cancel private network
+ // end-time is either: 'immediately' or 'end' (end means end of contract)
+ Transip_VpsService::cancelPrivateNetwork('privateNetwork-name', 'end-time');
+ echo 'Cancelled private network';
+} 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;
+}
\ No newline at end of file
diff --git a/examples/VpsService-cancelVps.php b/examples/VpsService-cancelVps.php
new file mode 100644
index 0000000..a21d790
--- /dev/null
+++ b/examples/VpsService-cancelVps.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // cancel VPS
+ // end-time is either: 'immediately' or 'end' (end means end of contract)
+ Transip_VpsService::cancelVps('vps-name', 'immediately');
+ echo 'Cancelled Vps';
+} 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;
+}
diff --git a/examples/VpsService-cloneVps.php b/examples/VpsService-cloneVps.php
new file mode 100644
index 0000000..98dcade
--- /dev/null
+++ b/examples/VpsService-cloneVps.php
@@ -0,0 +1,24 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try
+{
+ // clone this VPS to a new VPS with the same specs
+ Transip_VpsService::cloneVps('vps-name');
+ echo 'The vps clone has been started.';
+}
+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;
+}
diff --git a/examples/VpsService-createSnapshot.php b/examples/VpsService-createSnapshot.php
new file mode 100644
index 0000000..87d13b8
--- /dev/null
+++ b/examples/VpsService-createSnapshot.php
@@ -0,0 +1,21 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // Create snapshot for vps
+ Transip_VpsService::createSnapshot('vps-name', 'snapshot-description');
+ echo 'Starting snapshot';
+} 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;
+}
diff --git a/examples/VpsService-getActiveAddonsForVps.php b/examples/VpsService-getActiveAddonsForVps.php
new file mode 100644
index 0000000..62de357
--- /dev/null
+++ b/examples/VpsService-getActiveAddonsForVps.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // Get a list of all addons for given Vps
+ $addons = Transip_VpsService::getActiveAddonsForVps('vps-name');
+
+ print_r($addons);
+} 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;
+}
\ No newline at end of file
diff --git a/examples/VpsService-getAllIps.php b/examples/VpsService-getAllIps.php
new file mode 100644
index 0000000..cffa0f3
--- /dev/null
+++ b/examples/VpsService-getAllIps.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // Get a list of all the Ips
+ $allIps = Transip_VpsService::getAllIps();
+
+ print_r($allIps);
+} 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;
+}
diff --git a/examples/VpsService-getAllPrivateNetworks.php b/examples/VpsService-getAllPrivateNetworks.php
new file mode 100644
index 0000000..3e20ffc
--- /dev/null
+++ b/examples/VpsService-getAllPrivateNetworks.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // Get a list of all PrivateNetwork objects in your account
+ $privateNetworks = Transip_VpsService::getAllPrivateNetworks();
+
+ print_r($privateNetworks);
+} 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;
+}
diff --git a/examples/VpsService-getAvailabilityZones.php b/examples/VpsService-getAvailabilityZones.php
new file mode 100644
index 0000000..0290db9
--- /dev/null
+++ b/examples/VpsService-getAvailabilityZones.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // Get a vps by name
+ $zones = Transip_VpsService::getAvailableAvailabilityZones();
+
+ print_r($zones);
+} 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;
+}
diff --git a/examples/VpsService-getAvailableAddons.php b/examples/VpsService-getAvailableAddons.php
new file mode 100644
index 0000000..2184d33
--- /dev/null
+++ b/examples/VpsService-getAvailableAddons.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // Get a list of all available addons
+ $addons = Transip_VpsService::getAvailableAddons();
+
+ print_r($addons);
+} 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;
+}
diff --git a/examples/VpsService-getAvailableAddonsForVps.php b/examples/VpsService-getAvailableAddonsForVps.php
new file mode 100644
index 0000000..4023f51
--- /dev/null
+++ b/examples/VpsService-getAvailableAddonsForVps.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // Get a list of all the available addons for specific Vps
+ $addons = Transip_VpsService::getActiveAddonsForVps('vps-name');
+
+ print_r($addons);
+} 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;
+}
diff --git a/examples/VpsService-getAvailableProducts.php b/examples/VpsService-getAvailableProducts.php
new file mode 100644
index 0000000..d12436b
--- /dev/null
+++ b/examples/VpsService-getAvailableProducts.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // Get a list of all the products
+ $products = Transip_VpsService::getAvailableProducts();
+
+ print_r($products);
+} 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;
+}
diff --git a/examples/VpsService-getAvailableUpgrades.php b/examples/VpsService-getAvailableUpgrades.php
new file mode 100644
index 0000000..9f7f27e
--- /dev/null
+++ b/examples/VpsService-getAvailableUpgrades.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // Get a list of the possible upgrades for a specific VPS
+ $upgrades = Transip_VpsService::getAvailableUpgrades('vps-name');
+
+ print_r($upgrades);
+} 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;
+}
diff --git a/examples/VpsService-getCancellableAddonsForVps.php b/examples/VpsService-getCancellableAddonsForVps.php
new file mode 100644
index 0000000..adee73c
--- /dev/null
+++ b/examples/VpsService-getCancellableAddonsForVps.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // Get a list of all addon objects
+ $addons = Transip_VpsService::getCancellableAddonsForVps('vps-name');
+
+ print_r($addons);
+} 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;
+}
diff --git a/examples/VpsService-getIpsForVps.php b/examples/VpsService-getIpsForVps.php
new file mode 100644
index 0000000..01b793c
--- /dev/null
+++ b/examples/VpsService-getIpsForVps.php
@@ -0,0 +1,25 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try
+{
+ // Get a list of Ip objects
+ $ips = Transip_VpsService::getIpsForVps('vps-name');
+
+ print_r($ips);
+}
+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;
+}
diff --git a/examples/VpsService-getOperatingSystems.php b/examples/VpsService-getOperatingSystems.php
new file mode 100644
index 0000000..bbaefe7
--- /dev/null
+++ b/examples/VpsService-getOperatingSystems.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // Get a list of all OperatingSystem objects
+ $operatingSystemList = Transip_VpsService::getOperatingSystems();
+
+ print_r($operatingSystemList);
+} 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;
+}
diff --git a/examples/VpsService-getPooledTrafficInformation.php b/examples/VpsService-getPooledTrafficInformation.php
new file mode 100644
index 0000000..dbc2f63
--- /dev/null
+++ b/examples/VpsService-getPooledTrafficInformation.php
@@ -0,0 +1,33 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // Get all the traffic information for the current contract period by vps name
+
+ /**
+ * Returns Array with the following Elements:
+ *
+ * 'startDate'
+ * 'endDate'
+ * 'usedInBytes'
+ * 'usedTotalBytes'
+ * 'maxBytes'
+ */
+
+ $trafficInformation = Transip_VpsService::getPooledTrafficInformation();
+ print_r($trafficInformation);
+
+} 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;
+}
diff --git a/examples/VpsService-getPrivateNetworksByVps.php b/examples/VpsService-getPrivateNetworksByVps.php
new file mode 100644
index 0000000..7a5c6c8
--- /dev/null
+++ b/examples/VpsService-getPrivateNetworksByVps.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // Get a list of private network objects
+ $privateNetworks = Transip_VpsService::getPrivateNetworksByVps('vps-name');
+
+ print_r($privateNetworks);
+} 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;
+}
diff --git a/examples/VpsService-getSnapshotsByVps.php b/examples/VpsService-getSnapshotsByVps.php
new file mode 100644
index 0000000..c54e4d9
--- /dev/null
+++ b/examples/VpsService-getSnapshotsByVps.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // Get a list of all snapshots for a vps
+ $snapshotList = Transip_VpsService::getSnapshotsByVps('vps-name');
+
+ print_r($snapshotList);
+} 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;
+}
diff --git a/examples/VpsService-getTrafficInformationForVps.php b/examples/VpsService-getTrafficInformationForVps.php
new file mode 100644
index 0000000..b1d6c5e
--- /dev/null
+++ b/examples/VpsService-getTrafficInformationForVps.php
@@ -0,0 +1,33 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // Get all the traffic information for the current contract period by vps name
+
+ /**
+ * Returns Array with the following Elements:
+ *
+ * 'startDate'
+ * 'endDate'
+ * 'usedInBytes'
+ * 'usedTotalBytes'
+ * 'maxBytes'
+ */
+
+ $trafficInformation = Transip_VpsService::getTrafficInformationForVps('vps-name');
+ print_r($trafficInformation);
+
+} 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;
+}
diff --git a/examples/VpsService-getVps.php b/examples/VpsService-getVps.php
new file mode 100644
index 0000000..93bcb1d
--- /dev/null
+++ b/examples/VpsService-getVps.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // Get a vps by name
+ $vps = Transip_VpsService::getVps('vpsName');
+
+ print_r($vps);
+} 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;
+}
diff --git a/examples/VpsService-getVpsBackupsByVps.php b/examples/VpsService-getVpsBackupsByVps.php
new file mode 100644
index 0000000..b944e34
--- /dev/null
+++ b/examples/VpsService-getVpsBackupsByVps.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // Get backups
+ $backupList = Transip_VpsService::getVpsBackupsByVps('vps-name');
+
+ print_r($backupList);
+} 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;
+}
diff --git a/examples/VpsService-getVpses.php b/examples/VpsService-getVpses.php
new file mode 100644
index 0000000..6b373b2
--- /dev/null
+++ b/examples/VpsService-getVpses.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // Get a list of all Vps objects
+ $vpsList = Transip_VpsService::getVpses();
+
+ print_r($vpsList);
+} 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;
+}
diff --git a/examples/VpsService-handoverVps.php b/examples/VpsService-handoverVps.php
new file mode 100644
index 0000000..438307c
--- /dev/null
+++ b/examples/VpsService-handoverVps.php
@@ -0,0 +1,23 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // handover the vps to another account
+ Transip_VpsService::handoverVps('vps-name','target-account-name');
+
+ echo 'handover process started';
+
+} 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;
+}
diff --git a/examples/VpsService-installOperatingSystem.php b/examples/VpsService-installOperatingSystem.php
new file mode 100644
index 0000000..375bc05
--- /dev/null
+++ b/examples/VpsService-installOperatingSystem.php
@@ -0,0 +1,22 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // hostname is only used when installing a "preinstalled image" like plesk, directadmin or cpanel
+ Transip_VpsService::installOperatingSystem('vps-name','operating-system-name','hostname');
+ echo 'Operating system install in progress';
+} 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;
+}
diff --git a/examples/VpsService-installOperatingSystemUnattended.php b/examples/VpsService-installOperatingSystemUnattended.php
new file mode 100644
index 0000000..88d2f67
--- /dev/null
+++ b/examples/VpsService-installOperatingSystemUnattended.php
@@ -0,0 +1,53 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ $base64InstallText = base64_encode('
+## Mirror settings
+d-i mirror/country string manual
+d-i mirror/http/hostname string mirror.transip.net
+d-i mirror/http/directory string /debian/debian
+
+## Automatically choose keymapping, since VNC client will translate to the clients one
+d-i keymap select us
+
+## Automatically select the networking interface
+d-i netcfg/choose_interface select auto
+
+## Install ACPId so the machine is responsive to Ctrl+Alt+Del etc
+d-i pkgsel/include string acpid
+
+# Any hostname and domain names assigned from dhcp take precedence over
+# values set here. However, setting the values still prevents the questions
+# from being shown, even if values come from dhcp.
+d-i netcfg/get_hostname string test-vps
+d-i netcfg/get_domain string example.com
+
+# Controls whether or not the hardware clock is set to UTC.
+d-i clock-setup/utc boolean true
+
+# You may set this to any valid setting for $TZ; see the contents of
+# /usr/share/zoneinfo/ for valid values.
+d-i time/zone string Europe/Amsterdam
+
+# Controls whether to use NTP to set the clock during the install
+d-i clock-setup/ntp boolean true
+');
+
+ Transip_VpsService::installOperatingSystemUnattended('vps-name','debian-8',$base64InstallText);
+ echo 'Operating system install in progress';
+} 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;
+}
diff --git a/examples/VpsService-orderAddon.php b/examples/VpsService-orderAddon.php
new file mode 100644
index 0000000..afffc9e
--- /dev/null
+++ b/examples/VpsService-orderAddon.php
@@ -0,0 +1,23 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // order the addon for specific VPS, use array
+ $addon = array('addon-name');
+ Transip_VpsService::orderAddon('vps-name',$addon);
+ echo 'Ordered addon';
+} 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;
+}
\ No newline at end of file
diff --git a/examples/VpsService-orderPrivateNetwork.php b/examples/VpsService-orderPrivateNetwork.php
new file mode 100644
index 0000000..a172851
--- /dev/null
+++ b/examples/VpsService-orderPrivateNetwork.php
@@ -0,0 +1,20 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ Transip_VpsService::orderPrivateNetwork();
+ echo 'Ordered private network';
+} 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;
+}
\ No newline at end of file
diff --git a/examples/VpsService-orderVps.php b/examples/VpsService-orderVps.php
new file mode 100644
index 0000000..47b6419
--- /dev/null
+++ b/examples/VpsService-orderVps.php
@@ -0,0 +1,25 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ $productName = 'vps-bladevps-x1';
+ $addons = array();
+ $operatingSystemName = 'freebsd-10.2';
+ $hostname = '';
+
+ Transip_VpsService::orderVpsInAvailabilityZone($productName, $addons, $operatingSystemName, $hostname, 'ams0');
+ echo 'Ordered VPS';
+} 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;
+}
diff --git a/examples/VpsService-removeSnapshot.php b/examples/VpsService-removeSnapshot.php
new file mode 100644
index 0000000..54d1999
--- /dev/null
+++ b/examples/VpsService-removeSnapshot.php
@@ -0,0 +1,24 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try
+{
+ // Remove snapshot for vps
+ Transip_VpsService::removeSnapshot('vps-name', 'snapshot-name');
+ echo 'Removing snapshot';
+}
+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;
+}
diff --git a/examples/VpsService-removeVpsFromPrivateNetwork.php b/examples/VpsService-removeVpsFromPrivateNetwork.php
new file mode 100644
index 0000000..d6a134b
--- /dev/null
+++ b/examples/VpsService-removeVpsFromPrivateNetwork.php
@@ -0,0 +1,24 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try
+{
+ // Remove the VPS from a private Network
+ Transip_VpsService::removeVpsFromPrivateNetwork('vps-name', 'private-network-name');
+ echo 'Removing VPS from Private Network';
+}
+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;
+}
diff --git a/examples/VpsService-reset.php b/examples/VpsService-reset.php
new file mode 100644
index 0000000..bbbee9c
--- /dev/null
+++ b/examples/VpsService-reset.php
@@ -0,0 +1,24 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try
+{
+ // Reset a vps
+ Transip_VpsService::reset('vps-name');
+ echo 'The vps has been resetted.';
+}
+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;
+}
diff --git a/examples/VpsService-revertSnapshot.php b/examples/VpsService-revertSnapshot.php
new file mode 100644
index 0000000..9a3624c
--- /dev/null
+++ b/examples/VpsService-revertSnapshot.php
@@ -0,0 +1,24 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try
+{
+ // Revert snapshot for vps
+ Transip_VpsService::revertSnapshot('vps-name', 'snapshot-name');
+ echo 'Reverting snapshot';
+}
+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;
+}
diff --git a/examples/VpsService-revertSnapshotToOtherVps.php b/examples/VpsService-revertSnapshotToOtherVps.php
new file mode 100644
index 0000000..5f1b970
--- /dev/null
+++ b/examples/VpsService-revertSnapshotToOtherVps.php
@@ -0,0 +1,24 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try
+{
+ // Revert snapshot taken from vps-name to destination-vps-name
+ Transip_VpsService::revertSnapshotToOtherVps('vps-name', 'snapshot-name', 'destination-vps-name');
+ echo 'Reverting snapshot from vps-name';
+}
+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;
+}
diff --git a/examples/VpsService-revertVpsBackup.php b/examples/VpsService-revertVpsBackup.php
new file mode 100644
index 0000000..6f5beb9
--- /dev/null
+++ b/examples/VpsService-revertVpsBackup.php
@@ -0,0 +1,24 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try
+{
+ // Revert backup for vps
+ Transip_VpsService::revertVpsBackup('vps-name', 'backup-id');
+ echo 'Reverting backup';
+}
+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;
+}
diff --git a/examples/VpsService-setCustomerLock.php b/examples/VpsService-setCustomerLock.php
new file mode 100644
index 0000000..247b59b
--- /dev/null
+++ b/examples/VpsService-setCustomerLock.php
@@ -0,0 +1,26 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+
+ // enable customer lock
+ Transip_VpsService::setCustomerLock('vps-name',true);
+ echo 'vps is customer locked';
+ // disable customer lock
+ Transip_VpsService::setCustomerLock('vps-name',false);
+ echo 'vps is unlocked';
+
+} 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;
+}
diff --git a/examples/VpsService-start.php b/examples/VpsService-start.php
new file mode 100644
index 0000000..3fbfc16
--- /dev/null
+++ b/examples/VpsService-start.php
@@ -0,0 +1,24 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try
+{
+ // Start a vps
+ Transip_VpsService::start('vps-name');
+ echo 'The vps has been started.';
+}
+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;
+}
diff --git a/examples/VpsService-stop.php b/examples/VpsService-stop.php
new file mode 100644
index 0000000..6a3b7ab
--- /dev/null
+++ b/examples/VpsService-stop.php
@@ -0,0 +1,24 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try
+{
+ // Stop a vps
+ Transip_VpsService::stop('vps-name');
+ echo 'The vps has been stopped.';
+}
+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;
+}
diff --git a/examples/VpsService-updatePtrRecord.php b/examples/VpsService-updatePtrRecord.php
new file mode 100644
index 0000000..2d0cf97
--- /dev/null
+++ b/examples/VpsService-updatePtrRecord.php
@@ -0,0 +1,24 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try
+{
+ // Update the PTR Record for a IP
+ Transip_VpsService::updatePtrRecord('ip-address','ptr-string');
+ echo 'ptr string updated';
+}
+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;
+}
diff --git a/examples/VpsService-upgradeVps.php b/examples/VpsService-upgradeVps.php
new file mode 100644
index 0000000..64d3810
--- /dev/null
+++ b/examples/VpsService-upgradeVps.php
@@ -0,0 +1,23 @@
+
+ */
+
+// Include vpsservice
+require_once('Transip/VpsService.php');
+
+try {
+ // Upgrade a VPS
+ $operatingSystemList = Transip_VpsService::upgradeVps('vps-name','product-name');
+
+ echo 'Upgrading VPS';
+} 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;
+}
diff --git a/examples/WebhostingService-createMailBox.php b/examples/WebhostingService-createMailBox.php
new file mode 100644
index 0000000..5804c14
--- /dev/null
+++ b/examples/WebhostingService-createMailBox.php
@@ -0,0 +1,28 @@
+
+ */
+
+// 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', , )
+ $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;
+}
diff --git a/examples/WebhostingService-getInfo.php b/examples/WebhostingService-getInfo.php
new file mode 100644
index 0000000..e86a0b2
--- /dev/null
+++ b/examples/WebhostingService-getInfo.php
@@ -0,0 +1,178 @@
+
+ */
+
+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 = '';
+ $domain = null;
+ $result = '';
+}
+
+?>
+
+
+
+
+
+
TransIP API GetInfo Example
+ Fill in the domain you want to get information about and click on Get Info.
+
+
+
+ if(isset($domain)) {?>
+
+
MailBoxes
+
+
+
mailbox
+
spamCheckerStrength
+
maxDiskUsage
+
VacationReply
+
+
+ // iterate over each mailbox and output the info
+ foreach($domain->mailBoxes as $mailBox)
+ {
+ echo "
+
+ // iterate over each mailbox and output the info
+ foreach($domain->subDomains as $subDomain)
+ {
+ echo "
";
+ echo "
" . htmlspecialchars($subDomain->name) . "
";
+ echo "
";
+ }
+ ?>
+
+
+
+ }?>
+
+
diff --git a/examples/WebhostingService-getWebhostingDomainNames.php b/examples/WebhostingService-getWebhostingDomainNames.php
new file mode 100644
index 0000000..3c08b1e
--- /dev/null
+++ b/examples/WebhostingService-getWebhostingDomainNames.php
@@ -0,0 +1,31 @@
+
+ */
+
+// 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;
+}
+
+?>
\ No newline at end of file
diff --git a/examples/WebhostingService-order_and_upgrade.php b/examples/WebhostingService-order_and_upgrade.php
new file mode 100644
index 0000000..b1d7952
--- /dev/null
+++ b/examples/WebhostingService-order_and_upgrade.php
@@ -0,0 +1,37 @@
+
+ */
+
+// Include webhostingservice
+require_once('Transip/WebhostingService.php');
+
+try
+{
+ // Order webhosting for a domain you own
+ //
+ // We first need to get the available webhosting packages, so
+ // we can pick one to order
+ // This returns an array with the available WebhostingPackage objects.
+ //
+ // If we want to order an upgrade, we need to get the available upgrade packages and
+ // this call would be:
+ // $packages = Transip_WebhostingService::getAvailableUpgrades('transip.nl');
+ $packages = Transip_WebhostingService::getAvailablePackages();
+
+ // Now order the first available package
+ //
+ // If we want to upgrade this call would be
+ // Transip_WebhostingService::upgrade('transip.nl', $packages[0]);
+ Transip_WebhostingService::order('example.com', $packages[0]);
+}
+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;
+}