PHPackages                             cloudns/cloudns-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. cloudns/cloudns-sdk

ActiveProject[HTTP &amp; Networking](/categories/http)

cloudns/cloudns-sdk
===================

ClouDNS PHP SDK for HTTP API

195.7k↑464.3%13PHP

Since May 7Pushed 1mo ago6 watchersCompare

[ Source](https://github.com/ClouDNS/cloudns-php-sdk)[ Packagist](https://packagist.org/packages/cloudns/cloudns-sdk)[ RSS](/packages/cloudns-cloudns-sdk/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

ClouDNS SDK for HTTP API
========================

[](#cloudns-sdk-for-http-api)

Introduction
------------

[](#introduction)

This is the SDK for ClouDNS HTTP API. The document provides guidelines and examples on how to implement and use the ClouDNS SDK for our HTTP API. You can read more about the API at [cloudns.net](https://www.cloudns.net).

The SDK is based on the methods used in the [HTTP API](https://www.cloudns.net/wiki/article/41/).

Table of contents
-----------------

[](#table-of-contents)

- [Basic integration and requirements](#basic-integration-and-requirements)

    - [Installation](#installation)
    - [Initialization](#initialization)
- [SDK Functions](#sdk-functions)

    - [DNS](#dns)
    - [Domain](#domain)
    - [SSL](#ssl)
    - [Sub users](#sub-users)

Basic integration and requirements
----------------------------------

[](#basic-integration-and-requirements)

These are the minimal requirements to use/implement the ClouDNS SDK:

- PHP 5 or above;
- Access to the ClouDNS HTTP API;

### Installation

[](#installation)

#### Download

[](#download)

1. [Download](https://github.com/ClouDNS/cloudns-php-sdk/archive/master.zip) the SDK file.
2. Add the SDK file to your project's folder.
3. Include it in your project. Here is a basic example on how to do so:

```

```

#### composer

[](#composer)

1. install using `composer require cloudns/cloudns-sdk`

```

```

where `0000` is the ID of the API user (auth-id), `123456789` is the password of the API user (auth-password) and `false` indicates the type of the API user.

- For API sub-users with ID authorization (sub-auth-id):

```

```

where `0000` is the ID of the API sub-user (sub-auth-id), `123456789` is the password of the API sub-user (auth-password) and `true` indicates the type of the API user.

- For API sub-users with user authorization (sub-auth-user):

```

```

where `username` is the username set for the API sub-user (sub-auth-user), `123456789` is the password of the API sub-user (auth-password) and `true` indicates the type of the API user.

SDK Functions
-------------

[](#sdk-functions)

Here you will find examples for every method, used in the SDK. The methods are presented as PHP function calls and are divided into four main categories - DNS (for DNS zones, records, etc.), Domain (for registered domains), SSL (for SSL certificates) and Sub (for sub-users). They can be used only after a successful login to the API.

The basic construction of the functions is as follows:

```
exampleFunction (arg1, arg2, arg3, ... , argN);

```

where `exampleFunction` is the name of the function, that will be called, `(arg1, arg2, arg3, ... , argN)` are the arguments, required for the current function. Besides the required arguments, there are also **optional** ones, which are used only in certain cases and as such they are always at the end of the function. If the **optional** arguments are not required for a certain function they can be entered as empty, **NULL** value or can be skipped. Here is a function, where **arg1** and **arg2** are required arguments, while **arg3** and **arg4** are optional ones:

```
exampleFunction (arg1, arg2, NULL, " ");

```

or

```
exampleFunction (arg1, arg2);

```

As you can see the **optional** arguments are located at the end of the function and can be entered as **NULL** and/or empty value and/or skipped.

Note, that there are cases, where you will have to enter some of the **optional** arguments and ignore others - for example ignore **arg3** and enter **arg4**. In situations such as this one you can enter **arg3** as `NULL` or empty `' '` value, but you can not skip it.

### DNS

[](#dns)

1. Available name servers.- **Description**: Get a list with available domain name servers.
- **Example**:

```

```

2. Create a new DNS zone.- **Description**: Create/add a new DNS zone to your account. Works with Master, Slave, Parked, GeoDNS and Reverse DNS zone.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zone.zone typeString/RequiredThe type of the DNS zone - master/slave/parked/geodns/reverse.array ('ns1', 'ns2', 'nsn'...)Array/**Optional**Array with name servers, that will be added as NS records in the zone.1.2.3.4String/**Optional**IP address of the Master server, for Slave zones;
3. Delete a DNS zone.- **Description**: Delete an existing DNS zone. Works with Master, Slave and Reverse zones as well as cloud/bulk domains.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zone.
4. List DNS zones.- **Description**: Get a list of all DNS zones in your account or only the ones matching a certain criteria (keyword).
- **Example**:

```

```

NameData type/StatusDescriptioncurrent pageInteger/RequiredThe current page of your zone list.results per pageInteger/RequiredNumber of results per page, can be 10, 20, 30, 50 or 100.keywordString/**Optional**Criteria, which the results will be based on.
5. Get pages count.- **Description**: Amount of pages with DNS zones currently in your account. It can be combined to give results based on criteria (keyword).
- **Example**:

```

```

NameData type/StatusDescriptionresults per pageInteger/RequiredNumber of results per page, can be 10, 20, 30, 50 or 100.keywordString/**Optional**Criteria, which the results will be based on.
6. Get zones statistics.- **Description**: Shows information about the amount of DNS zones currently in the account and the zone limit, that is available for the account's subscription plan.
- **Example**:

```

```

7. Get zone information.- **Description**: Shows information about the DNS zone - status, type.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zone.
8. Update zone.- **Description**: Updates a DNS zone.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zone.
9. Update status.- **Description**: Shows information for update status of the DNS zone and a list of name servers.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zone.
10. Is updated.- **Description**: Shows the update status of the DNS zone for a list of name servers - **TRUE** if it is updated on all servers and **FALSE** if not.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zone.
11. Change zone's status.- **Description**: Change the status of the DNS zone - active/inactive.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zonestatusInteger/**Optional**Status indicator, **1** to activate, 0 to deactivate. If the argument is skipped, the status will be toggled
12. List records.- **Description**: Shows a list of records currently in the DNS zone. The results can also be based on host name and/or record type.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zonehostString/**Optional**Host, which the records will be shown forrecord typeString/**Optional**Specify the type of record to be listed. For available record types, see "Get the available record types" function.
13. Add record.- **Description**: Adds a record to the DNS zone.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zonerecord typeString/RequiredType of the DNS record. For available record types, see "Get the available record types" function.hostString/RequiredHost name of the record. Leave empty for root hoss.recordString/RequiredThe specific requirements for the record - where to be pointed at (e.g. IP, hostname, server), strings, authentications, etc.ttlInteger/RequiredThe TTL of the record. The available TTL's are as follows: 60 = 1 minute 300 = 5 minutes 900 = 15 minutes, 1800 = 30 minutes, 3600 = 1 hour, 21600 = 6 hours, 43200 = 12 hours, 86400 = 1 day, 172800 = 2 days, 259200 = 3 days, 604800 = 1 week, 1209600 = 2 weeks, 2592000 = 1 monthpriorityInteger/**Optional**Priority option for MX and SRV records.weightInteger/**Optional**Weight option for SRV recordportInteger/**Optional**Port option for SRV recordframeInteger/**Optional**Toggles the redirect with frame option for Web Redirect record: 0 for disable, **1** for enable.frame-titleString/**Optional**Title for the redirect with frame option for Web Redirect record.frame-keywordsString/**Optional**Keywords for the redirect with frame option for Web Redirect record.frame-descriptionString/**Optional**Description for the redirect with frame option for Web Redirect record.save-pathInteger/**Optional**Save path option for redirecting with Web Redirect record - 0 for disable, **1** for enable.redirect-typeInteger/**Optional**Unmasked redirects for Web Redirect record if the redirect with frame is disabled - **301** for constant type or **302** for temporary type.mailString/**Optional**E-mail address for RP records.txtString/**Optional**Domain name for TXT record used in RP records.algorithmInteger/**Optional**Algorithm required to create for SSHFP records.fptypeInteger/**Optional**Type of the SSHFP algorithm.statusInteger/**Optional**Status of the record - **1** for active and 0 for inactive. If skipped, the record will be set as active.geodns-locationInteger/**Optional**ID of the GeoDNS location that can be set for A, AAAA, CNAME, NAPTR or SRV records. The location's ID can be obtained from the **List GeoDNS locations** function.caa-flagInteger/**Optional**Flag option for CAA records - 0 for Non critical and **128** for Critical.caa-typeString/**Optional**Type of the CAA record, which can be **issue**, **issuewild** and **iodef**.caa-valueString/**Optional**Value of the CAA record. Depending on the type of the CAA record, '`caa-type'`, it can be set as follows: if `'caa-type'` is issue the `'caa-value'` can be hostname or ";". If `'caa-type'` is issuewild the `'caa-value'` can be hostname or ";". If `'caa-type'` is iodef the `'caa-value'` ",  or .
14. Delete record.- **Description**: Deletes a record in the DNS zone.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zonerecordIDInteger/RequiredID of the record. The ID can be found using the **List records** function.
15. Modify record.- **Description**: Modify (edit) a record.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zonerecordIDInteger/RequiredID of the record. The ID can be found using the **List records** function.hostString/RequiredHost name of the record. Leave empty for root hoss.recordString/RequiredThe specific requirements for the record - where to be pointed at (e.g. IP, hostname, server), strings, authentications, etc.ttlInteger/RequiredThe TTL of the record. The available TTL's are as follows: 60 = 1 minute 300 = 5 minutes 900 = 15 minutes, 1800 = 30 minutes, 3600 = 1 hour, 21600 = 6 hours, 43200 = 12 hours, 86400 = 1 day, 172800 = 2 days, 259200 = 3 days, 604800 = 1 week, 1209600 = 2 weeks, 2592000 = 1 monthpriorityInteger/**Optional**Priority option for MX and SRV records.weightInteger/**Optional**Weight option for SRV recordportInteger/**Optional**Port option for SRV recordframeInteger/**Optional**Toggles the redirect with frame option for Web Redirect record: 0 for disable, **1** for enable.frame-titleString/**Optional**Title for the redirect with frame option for Web Redirect record.frame-keywordsString/**Optional**Keywords for the redirect with frame option for Web Redirect record.frame-descriptionString/**Optional**Description for the redirect with frame option for Web Redirect record.save-pathInteger/**Optional**Save path option for redirecting with Web Redirect record - 0 for disable, **1** for enable.redirect-typeInteger/**Optional**Unmasked redirects for Web Redirect record if the redirect with frame is disabled - **301** for constant type or **302** for temporary type.mailString/**Optional**E-mail address for RP records.txtString/**Optional**Domain name for TXT record used in RP records.algorithmInteger/**Optional**Algorithm required to create for SSHFP records.fptypeInteger/**Optional**Type of the SSHFP algorithm.statusInteger/**Optional**Status of the record - **1** for active and 0 for inactive. If skipped, the record will be set as active.geodns-locationInteger/**Optional**ID of the GeoDNS location that can be set for A, AAAA, CNAME, NAPTR or SRV records. The location's ID can be obtained from the **List GeoDNS locations** function.caa-flagInteger/**Optional**Flag option for CAA records - 0 for Non critical and **128** for Critical.caa-typeString/**Optional**Type of the CAA record, which can be **issue**, **issuewild** and **iodef**.caa-valueString/**Optional**Value of the CAA record. Depending on the type of the CAA record, '`caa-type'`, it can be set as follows: if `'caa-type'` is issue the `'caa-value'` can be hostname or ";". If `'caa-type'` is issuewild the `'caa-value'` can be hostname or ";". If `'caa-type'` is iodef the `'caa-value'` ",  or .
16. Copy records.- **Description**: Copies all the records from a specific zone.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zone, which the records will be copied to.domain-2.tldString/RequiredDomain name of the DNS zone, which the records will be copied from.delete-recordsInteger/**Optional**If entered (set to 1), deletes all the current records, if such exists, from domain.tld.
17. Import records.- **Description**: Imports the records of a zone.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zone, which the records will be imported to.formatString/RequiredThe format, which will be used to import the records. The available formats are **bind** and **tinydns**.records-listString/RequiredList of the records based on the chosen format. The records must be added one per row.delete-recordsInteger/**Optional**If entered (set to 1), deletes all the current records, if such exists, from domain.tld.
18. Export records in BIND format.- **Description**: Exports the zone records in BIND format.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zone, which the records will be exported from in BIND format.
19. Get the available record types.- **Description**: Shows the available record types, that can be set up, based on the DNS zone type.
- **Example**:

```

```

NameData type/StatusDescriptionzone-typeString/Requiredtype of the DNS zone. The value can be **domain** for Master DNS zones, **reverse** for Reverse DNS zones and **parked** for Parked DNS zones.
20. Get the available TTL.- **Description**: Shows the available TTL, that can be set for the records.
- **Example**:

```

```

21. Get SOA details.- **Description**: Shows the SOA details of the DNS zone.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zone, which the SOA details will be shown for.
22. Modify SOA details.- **Description**: Modify (edit) the SOA details of the DNS zone.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zone, which the SOA details will be modified for.ns.nameserver.tldString/RequiredHost name of the primary name server.Integer/RequiredDNS admin email.refreshInteger/RequiredRefresh rate. The value must be between **1200** and **43200** seconds.retryInteger/RequiredRetry rate. The value must be between **180** and **2419200** seconds.expireInteger/RequiredExpire rate. The value must be between **1209600** and **2419200** seconds.ttlInteger/RequiredDefault TTL. The value must be between **60** and **2419200** seconds.
23. Get DynamicURL.- **Description**: Returns the DynamicURL of an A or AAAA record.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zone.recordIDInteger/RequiredID of the A or AAAA record. The ID can be found using the **List records** function.
24. Disable DynamicURL.- **Description**: Disable the DynamicURL of an A or AAAA record.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zone.recordIDInteger/RequiredID of the A or AAAA record. The ID can be found using the **List records** function.
25. Change DynamicURL.- **Description**: Change the DynamicURL of an A or AAAA record.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zone.recordIDInteger/RequiredID of the A or AAAA record. The ID can be found using the **List records** function.
26. Change record's status.- **Description**: Changes the status of the record to active/inactive.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zone.recordIDInteger/RequiredID of record. The ID can be found using the **List records** function.statusInteger/**Optional**Status of the record - **1** for active and 0 for inactive. If skipped, the record will be toggled.
27. Add master server.- **Description**: Add new master server to a DNS zone. Only available for Secondary DNS zones and Secondary Reverse DNS zones.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zone.IPString/RequiredIP address of the new master server.
28. Delete master server.- **Description**: Delete master server of a DNS zone. Only available for Slave DNS zones and Slave Reverse DNS zones.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zone.masterIDInteger/RequiredID of the master server. It can be obtained from the **List master servers** function.
29. List master servers.- **Description**: List the master servers of the DNS zone. Only available for Slave DNS zones and Slave Reverse DNS zones.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zone.
30. Get mail forwards statistics.- **Description**: Gives details about the amount of mail servers and the mail forwards limit that is available for the account.
- **Example**:

```

```

31. Available mail forward servers.- **Description**: Shows the available mail forward servers for the account.
- **Example**:

```

```

32. Add mail forward.- **Description**: Add new mail forward to a DNS zone.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zone, which the mail forward will be added for.boxString/RequiredName of the mailbox for the mail forward.hostString/RequiredHost of the mailbox. If empty, the mail forward will be created for the main domain name.destination-mailString/RequiredExisting email address, where the mail forwards will be received from.
33. Delete mail forward.- **Description**: Delete a mail forward for a specified DNS zone.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zone, which the mail forward will be removed from.mailIDInteger/RequiredID of the mail forward. It can be obtained from the **List mail forwards** function.
34. Modify (edit) mail forward.- **Description**: Modify a mail forward of a DNS zone.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zone, which the mail forward will be added for.boxString/RequiredName of the mailbox for the mail forward.hostString/RequiredHost of the mailbox. If empty, the mail forward will be created for the main domain name.destination-mailString/RequiredExisting email address, where the mail forwards will be received from.mailIDInteger/RequiredID of the mail forward. It can be obtained from the **List mail forwards** function.
35. List mail forwards.- **Description**: List the mail forwards of the DNS zone.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zone, which the mail forwards will be listed for.
36. Add cloud domain.- **Description**: Adds a cloud domain.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredMaster domain of the cloud.cloud-domain.tldString/RequiredThe new domain in the cloud.
37. Delete cloud domain.- **Description**: Deletes a cloud domain.
- **Example**:

```

```

NameData type/StatusDescriptioncloud-domain.tldString/RequiredCloud domain that will be deleted.
38. Change cloud master.- **Description**: Sets a new master of the cloud.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the new cloud master.
39. List cloud domains.- **Description**: Lists all domains in the cloud.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredMaster domain of the cloud.
40. Allow new IP.- **Description**: Allow new IP address of a slave server for zone transfers.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name, which the slave server's IP address will be added for zone transfers.IPString/RequiredIP address of the slave server.
41. Delete an allowed IP.- **Description**: Removes slave server's IP address for zone transfers.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zoneIPInteger/RequiredIP address of the slave server.
42. List allowed IP's.- **Description**: List all of the allowed IP addresses for zone transfers.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zone
43. Hourly statistics.- **Description**: Shows hourly statistics for the DNS zone.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zoneyearInteger/RequiredThe year, which the statistics will be shown for.monthInteger/RequiredThe month, which the statistics will be shown for.dayInteger/RequiredThe day, which the statistics will be shown for.
44. Daily statistics.- **Description**: Shows daily statistics for the DNS zone.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zoneyearInteger/RequiredThe year, which the statistics will be shown for.monthInteger/RequiredThe month, which the statistics will be shown for.
45. Monthly statistics.- **Description**: Shows monthly statistics for the DNS zone.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zoneyearInteger/RequiredThe year, which the statistics will be shown for.
46. Yearly statistics.- **Description**: Shows yearly statistics for the DNS zone.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zone
47. Statistics for the last 30 days.- **Description**: Shows statistics of the DNS zone for the last 30 days.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the DNS zone
48. Get templates for parked pages.- **Description**: Shows the templates, that we provide, fo.
- **Example**:

```

```

49. Get parked zones settings.- **Description**: Shows the settings of the parked zone.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the parked DNS zone
50. Modify parked zones settings.- **Description**: Modify (edit) the settings of a parked zone.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the parked DNS zonetemplateIDInteger/RequiredID of the template for the parked zone. It can be **1**, **2**, **3** or **4**. The available templates can be obtained from the "Get templates for parked pages" function.titleString/**Optional**Title of the parked page.descriptionString/**Optional**Description of the parked page.keywordsString/**Optional**Keywords of the parked page.contact-formInteger/**Optional**Enables or disables the contact form of the parked page - **1** for enabled, **2** for disabled and 0 is the default value.
51. List GeoDNS locations.- **Description**: Lists all the GeoDNS locations.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the GeoDNS zone.
52. Add group.- **Description**: Create new group and add a certain DNS zone in the group instantly.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name you wish to add in the group.nameString/RequiredName of the group.
53. Change group.- **Description**: Change the group which a DNS zone belongs to.
- **Example**:

```

```

NameData type/StatusDescriptiondomain.tldString/RequiredDomain name of the zone.group-idString/RequiredID of the relevant group.
54. List groups.- **Description**: Gets a list with all groups you have added for your DNS zones.
- **Example**:

```

```

55. Delete group.- **Description**: Delete a certain group of yours.
- **Example**:

```

```

NameData type/StatusDescriptiongroup-idString/RequiredID of the relevant group.
56. Rename group.- **Description**: Rename a certain group of yours.
- **Example**:

```
