domainreseller / php-dna
DomainNameAPI PHP Library for Domain Management
v2.1.13
2025-04-07 23:45 UTC
Requires (Dev)
- phpunit/phpunit: ^9.0
README
TR



Installation and Integration Guide
Minimum Requirements
- PHP7.4 or higher (Recommended 8.1)
- PHP SOAPClient extension must be active.
A) Manual Usage
Download the files and examine the examples in the examples folder.
require_once __DIR__.'/src/DomainNameAPI_PHPLibrary.php'; $dna = new \DomainNameApi\DomainNameAPI_PHPLibrary('username','password');
B) Composer ile entegrasyon için
composer require domainreseller/php-dna
require_once __DIR__.'/vendor/autoload.php'; $dna = new \DomainNameApi\DomainNameAPI_PHPLibrary('username','password');
Usage
Domain Registration Operations
Note: Additional parameters are required for .tr domains. The Additional parameter is used for domain names that require extra information like .tr.
$contact = [ "FirstName" => 'John', "LastName" => 'Doe', "Company" => 'Example Corp', "EMail" => 'john.doe@example.com', "AddressLine1" => '123 Lorem Street', "AddressLine2" => 'Suite 456', "AddressLine3" => '', "City" => 'Springfield', "Country" => 'US', "Fax" => '1234567890', "FaxCountryCode" => '1', "Phone" => '9876543210', "PhoneCountryCode" => 1, "Type" => 'Contact', "ZipCode" => '12345', "State" => 'IL' ]; $a->RegisterWithContactInfo( 'example.com', 1, [ 'Administrative' => $contact, 'Billing' => $contact, 'Technical' => $contact, 'Registrant' => $contact ], ["ns1.example.com", "ns2.example.com"], true, false, //Addional attributes sadece .tr domainler için gereklidir. [ 'TRABISDOMAINCATEGORY' => 1, 'TRABISCITIZIENID' => '12345678901', 'TRABISNAMESURNAME' => 'John Doe', 'TRABISCOUNTRYID' => '840', 'TRABISCITYID' => '17' ]);
Sample Output for Domain Registration
Array ( [result] => OK [data] => Array ( [ID] => 123456 [Status] => clientTransferProhibited [DomainName] => example.com [AuthCode] => Xy9#mK2$pL5@vN8 [LockStatus] => true [PrivacyProtectionStatus] => false [IsChildNameServer] => false [Contacts] => Array ( [Billing] => Array ( [ID] => 987654 ) [Technical] => Array ( [ID] => 987654 ) [Administrative] => Array ( [ID] => 987654 ) [Registrant] => Array ( [ID] => 987654 ) ) [Dates] => Array ( [Start] => 2024-03-15T10:00:00+03:00 [Expiration] => 2025-03-15T10:00:00+03:00 [RemainingDays] => 365 ) [NameServers] => Array ( [0] => ns1.example.com [1] => ns2.example.com ) [Additional] => Array ( [TRABISDOMAINCATEGORY] => 1 [TRABISCITIZIENID] => 98765432109 [TRABISNAMESURNAME] => Jane Smith [TRABISCOUNTRYID] => 840 [TRABISCITYID] => 34 ) [ChildNameServers] => Array ( ) ) ) )
Domain Renewal
$dna->Renew('example.com', 1);
Sample Output for Domain Renewal
Array ( [result] => OK [data] => Array ( [ExpirationDate] => 2025-03-15T10:00:00+03:00 ) )
Domain Transfer
$dna->Transfer('example.com', 'Xy9#mK2$', 3);
Sample Output for Domain Transfer
Array ( [result] => OK )
Domain List
$dna->GetList(['OrderColumn'=>'Id', 'OrderDirection'=>'ASC', 'PageNumber'=>0,'PageSize'=>1000]);
Sample Output for Domain List
Array ( [data] => Array ( [Domains] => Array ( [0] => Array ( [ID] => 564346 [Status] => Active [DomainName] => example.com [AuthCode] => DHQ!K52 [LockStatus] => false [PrivacyProtectionStatus] => false [IsChildNameServer] => false [Contacts] => Array ( [Billing] => Array ( [ID] => 11854114 ) [Technical] => Array ( [ID] => 11854114 ) [Administrative] => Array ( [ID] => 11854114 ) [Registrant] => Array ( [ID] => 11854114 ) ) [Dates] => Array ( [Start] => 2024-03-15T10:00:00+03:00 [Expiration] => 2025-03-15T10:00:00+03:00 [RemainingDays] => 365 ) [NameServers] => Array ( [0] => ns1.example.com [1] => ns2.example.com ) [Additional] => Array ( [TRABISDOMAINCATEGORY] => 1 [TRABISCITIZIENID] => 98765432109 [TRABISNAMESURNAME] => Jane Smith [TRABISCOUNTRYID] => 215 [TRABISCITYID] => 34 ) [ChildNameServers] => Array ( [0] => Array ( [Name] => ns1.example.com [IP] => 1.2.3.4 ) [1] => Array ( [Name] => ns2.example.com [IP] => 2.3.4.5 ) ) ) ) ) [result] => OK )
TLD List
$dna->GetTldList(100);
Sample Output for TLD List
Array ( [data] => Array ( [0] => Array ( [id] => 1971 [status] => Active [maxchar] => 63 [maxperiod] => 10 [minchar] => 3 [minperiod] => 1 [tld] => cc.bh [pricing] => Array ( [backorder] => Array ( [1] => 149.9900 ) [refund] => Array ( [1] => 149.9900 ) [restore] => Array ( [1] => 85.0000 ) [transfer] => Array ( [1] => 149.9900 ) [renew] => Array ( [1] => 149.9900 ) [registration] => Array ( [1] => 149.9900 ) ) [currencies] => Array ( [backorder] => USD [refund] => USD [restore] => USD [transfer] => USD [renew] => USD [registration] => USD ) ) [1] => Array ( [id] => 1956 [status] => Active [maxchar] => 63 [maxperiod] => 10 [minchar] => 3 [minperiod] => 1 [tld] => aaa.pro [pricing] => Array ( [backorder] => Array ( [1] => 156.2500 ) [refund] => Array ( [1] => 156.2500 ) [restore] => Array ( [1] => 80.0000 ) [transfer] => Array ( [1] => 156.2500 ) [renew] => Array ( [1] => 156.2500 ) [registration] => Array ( [1] => 156.2500 ) ) [currencies] => Array ( [backorder] => USD [refund] => USD [restore] => USD [transfer] => USD [renew] => USD [registration] => USD ) ) ) [result] => OK )
Domain Availability Check
$dna->CheckAvailability('example.com',1,'create');
Sample Output for Domain Availability Check
*Array ( [0] => Array ( [TLD] => com [DomainName] => hello [Status] => notavailable [Command] => create [Period] => 1 [IsFee] => [Price] => 9.9900 [Currency] => USD [Reason] => Domain exists ) [1] => Array ( [TLD] => net [DomainName] => world123x0 [Status] => available [Command] => create [Period] => 1 [IsFee] => [Price] => 12.9900 [Currency] => USD [Reason] => ) [2] => Array ( [TLD] => net [DomainName] => hello [Status] => notavailable [Command] => create [Period] => 1 [IsFee] => [Price] => 12.9900 [Currency] => USD [Reason] => Domain exists ) [3] => Array ( [TLD] => com [DomainName] => world123x0 [Status] => available [Command] => create [Period] => 1 [IsFee] => [Price] => 9.9900 [Currency] => USD [Reason] => ) )
Domain Details
$dna->GetDetails('example.com');
Sample Output for Domain Details
Array ( [data] => Array ( [ID] => 564346 [Status] => Active [DomainName] => example.com [AuthCode] => DHQ!K52 [LockStatus] => false [PrivacyProtectionStatus] => false [IsChildNameServer] => false [Contacts] => Array ( [Billing] => Array ( [ID] => 11854114 ) [Technical] => Array ( [ID] => 11854114 ) [Administrative] => Array ( [ID] => 11854114 ) [Registrant] => Array ( [ID] => 11854114 ) ) [Dates] => Array ( [Start] => 2025-05-26T16:08:37 [Expiration] => 2027-05-26T16:08:37 [RemainingDays] => 449 ) [NameServers] => Array ( "ns1.example.com", "ns2.example.com" ) [Additional] => Array ( [TRABISDOMAINCATEGORY] => 1 [TRABISCITIZIENID] => 1112221111111 [TRABISNAMESURNAME] => "Bunyamin Mutlu" [TRABISCOUNTRYID] => 215 [TRABISCITYID] => 41 ) [ChildNameServers] => Array ( Array ( [Name] => 'ns1.example.com' [IP] =>'1.2.3.4' ) Array ( [Name] => 'ns2.example.com' [IP] =>'2.3.4.5' ) ) ) [result] => OK )
Nameserver Modification
$dna->ModifyNameServer('example.com', [ 'ns1'=>'ns1.example.com', 'ns2'=>'ns2.example.com' ]);
Sample Output for Nameserver Modification
Array ( [data] => Array ( [NameServers] => Array ( [ns1] => ns1.example.com [ns2] => ns2.example.com ) ) [result] => OK )
Enable Domain Lock
$lock = $dna->EnableTheftProtectionLock('example.com');
Sample Output for Enable Domain Lock
Array ( [data] => Array ( [LockStatus] => true ) [result] => OK )
Disable Domain Lock
$lock = $dna->DisableTheftProtectionLock('example.com');
Sample Output for Disable Domain Lock
Array ( [data] => Array ( [LockStatus] => false ) [result] => OK )
Add Child Nameserver
$dna->AddChildNameServer('example.com', 'ns1.example.com', '1.2.3.4');
Sample Output for Add Child Nameserver
Array ( [data] => Array ( [NameServer] => test5.example.com [IPAdresses] => Array ( [0] => 1.2.3.4 ) ) [result] => OK )
Delete Child Nameserver
$dna->DeleteChildNameServer('example.com', 'test5.example.com');
Sample Output for Delete Child Nameserver
Array ( [result] => OK )
Update Child Nameserver
$dna->ModifyChildNameServer('example.com', 'test5.example.com', '1.2.3.4');
Sample Output for Update Child Nameserver
Array ( [data] => Array ( [NameServer] => test5.example.com [IPAdresses] => Array ( [0] => 1.2.3.4 ) ) [result] => OK )
Modify Domain Privacy
$lock = $dna->ModifyPrivacyProtectionStatus('example.com', true, 'owners optional comment');
Sample Output for Modify Domain Privacy
Array ( [result] => OK [data] => => Array ( [PrivacyProtectionStatus] =>trıe ) )
Save Domain Contact
$contact = [ "FirstName" => 'Bunyamin', "LastName" => 'Mutlu', "Company" => '', "EMail" => 'bun.mutlu@gmail.com', "AddressLine1" => 'adres 1 adres 1 adres 1 ', "AddressLine2" => 'test test', "AddressLine3" => '', "City" => 'Kocaeli', "Country" => 'TR', "Fax" => '2626060026', "FaxCountryCode" => '90', "Phone" => '5555555555', "PhoneCountryCode" => 90, "Type" => 'Contact', "ZipCode" => '41829', "State" => 'GEBZE' ]; $dna->SaveContacts('example.com','ns1','1.2.3.4');
Sample Output for Save Domain Contact
Array ( [result] => OK )
Get Reseller Details
$dna->GetResellerDetails();
Sample Output for Get Reseller Details
Array ( [result] => OK [id] => 12345 [active] => 1 [name] => TEST ACCOUNT 1 [balance] => 0.0000 [currency] => USD [symbol] => $ [balances] => Array ( [0] => Array ( [balance] => 0.0000 [currency] => USD [symbol] => $ ) [1] => Array ( [balance] => 0.0000 [currency] => TL [symbol] => TL ) ) )
Return and Error Codes with Descriptions
Code | Description | Detail |
---|---|---|
1000 | Command completed successfully | Operation successful. |
1001 | Command completed successfully; action pending | Operation successful. However, the operation is currently queued for completion. |
2003 | Required parameter missing | Parameter missing error. For example, no phone entry in contact information. |
2105 | Object is not eligible for renewal | Domain status is not suitable for renewal, locked for update operations. Status should not be "clientupdateprohibited". May be due to other status conditions. |
2200 | Authentication error | Authorization error, security code is incorrect or domain is registered with another registrar. |
2302 | Object exists | Domain name or nameserver information already exists in database. Cannot be registered. |
2303 | Object does not exist | Domain name or nameserver information does not exist in database. New registration required. |
2304 | Object status prohibits operation | Domain status is not suitable for updates, locked for update operations. Status should not be "clientupdateprohibited". May be due to other status conditions. |