├── .github └── FUNDING.yml ├── LICENSE ├── README.md ├── benchmark ├── Benchmark.php ├── Connection.php └── Helpers.php ├── composer.json ├── examples ├── Connection.php ├── Connection2.php ├── ConnectionDB.php ├── ContactCheck.php ├── ContactCreate.php ├── ContactDelete.php ├── ContactInfo.php ├── ContactUpdate.php ├── DomainCheck.php ├── DomainCheckClaims.php ├── DomainCreate.php ├── DomainCreateClaims.php ├── DomainCreateDNSSEC.php ├── DomainCreateSunrise.php ├── DomainDelete.php ├── DomainInfo.php ├── DomainRenew.php ├── DomainReport.php ├── DomainRestore.php ├── DomainTransfer.php ├── DomainUpdateAuthinfo.php ├── DomainUpdateContact.php ├── DomainUpdateDNSSEC.php ├── DomainUpdateNS.php ├── DomainUpdateStatus.php ├── Hello.php ├── HostCheck.php ├── HostCreate.php ├── HostDelete.php ├── HostInfo.php ├── HostUpdate.php ├── KeepAlive.php ├── PollAck.php ├── PollReq.php ├── RRIConnection.php ├── RawXml.php ├── TMCHCron.php └── TMCHExample.php ├── log └── .gitignore └── src ├── Epp.php ├── EppRegistryFactory.php ├── EppRegistryInterface.php ├── Exception ├── EppException.php └── EppNotConnectedException.php ├── RRIClient.php └── Registries ├── EuEpp.php ├── FiEpp.php ├── FrEpp.php ├── FredEpp.php ├── GenericEpp.php ├── GrEpp.php ├── HkEpp.php ├── HrEpp.php ├── ItEpp.php ├── LvEpp.php ├── MxEpp.php ├── NoEpp.php ├── PlEpp.php ├── PtEpp.php ├── SeEpp.php ├── UaEpp.php └── VrsnEpp.php /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | custom: 4 | - https://donate.stripe.com/7sI2aI4jV3Offn28ww 5 | - https://www.blockchain.com/btc/address/bc1q9jhxjlnzv0x4wzxfp8xzc6w289ewggtds54uqa 6 | - https://etherscan.io/address/0x330c1b148368EE4B8756B176f1766d52132f0Ea8 -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Pinga 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Namingo EPP Client 2 | 3 | An open-source PHP EPP client supporting 36 domain registry backends. Works with any PHP framework and is fully customizable. 4 | 5 | [![StandWithUkraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md) 6 | 7 | [![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md) 8 | 9 | ## Introduction 10 | 11 | **Namingo EPP** is an open-source PHP EPP client that enables seamless connection to EPP servers for domain registration and management. It supports multiple EPP extensions, integrates easily with any PHP framework, and is fully customizable for various domain registries. 12 | 13 | The client also provides EPP modules for WHMCS and FOSSBilling, supporting all essential features for efficient domain management. 14 | 15 | ## Get Involved 16 | 17 | We're on a mission to make **Namingo** the best it can be, and we need your expertise! Whether you're adept in development, have a keen eye for design, or simply brim with innovative ideas, your contribution can make a world of difference. 18 | 19 | ## Features 20 | 21 | ### Supported EPP Commands 22 | 23 | | | domain | contact | host | session | 24 | |----------|----------|----------|----------|----------| 25 | | check | ✅ | ✅ | ✅ | login ✅ | 26 | | checkClaims | ✅ | N/A | N/A | logout ✅ | 27 | | info | ✅ | ✅ | ✅ | poll ✅ | 28 | | create | ✅ | ✅ | ✅ | hello ✅ | 29 | | createDNSSEC | ✅ | N/A | N/A | keep-alive ✅ | 30 | | createClaims | ✅ | N/A | N/A | new password ✅ | 31 | | update | N/A | ✅ | ✅ | | 32 | | updateNS | ✅ | N/A | N/A | | 33 | | updateContact | ✅ | N/A | N/A | | 34 | | updateAuthinfo | ✅ | N/A | N/A | | 35 | | updateStatus | ✅ | ❌ | ❌| | 36 | | updateDNSSEC | ✅ | N/A | N/A | | 37 | | renew | ✅ | N/A | N/A | | 38 | | delete | ✅ | ✅ | ✅ | | 39 | | transferRequest | ✅ | ❌ | ❌ | | 40 | | transferQuery | ✅ | ❌ | ❌ | | 41 | | transferApprove | ✅ | ❌ | ❌ | | 42 | | transferReject | ✅ | ❌ | ❌ | | 43 | | transferCancel | ✅ | ❌ | ❌ | | 44 | | rgp:restore | ✅ | N/A | N/A | | 45 | | rgp:report | ✅ | N/A | N/A | | 46 | 47 | ### Supported Connection Types 48 | 49 | | type | status | 50 | |----------|----------| 51 | | EPP over TLS/TCP | ✅ | 52 | | EPP over HTTPS | ✅ | 53 | | RRI | ✅ | 54 | | TMCH | ✅ | 55 | | REGRR | ❌ | 56 | 57 | ### Registry Support (36 backends and counting) 58 | 59 | | Registry | TLDs | Extension | Status | TODO | 60 | |----------|----------|----------|----------|----------| 61 | | Generic RFC EPP | any | | ✅ | | 62 | | AFNIC | .fr/others | FR | ✅ | | 63 | | CARNET | .hr | HR | ✅ | | 64 | | Caucasus Online | .ge | | ✅ | | 65 | | CentralNic | all | | ✅ | | 66 | | CoCCA | all | | ✅ | | 67 | | CORE/Knipp | all | | ✅ | | 68 | | DENIC | .de | | ✅ | | 69 | | Domicilium | .im | | ✅ | | 70 | | DOMREG | .lt | LT | 🚧 | work on extensions | 71 | | DRS.UA | all | | ✅ | | 72 | | EURid | .eu | EU | ✅ | | 73 | | FORTH-ICS | .gr, .ελ | GR | ✅ | | 74 | | FRED | .cz/any | FRED | ✅ | domain update NS/DNSSEC | 75 | | GoDaddy Registry | all | | ✅ | | 76 | | Google Nomulus | all | | ✅ | | 77 | | Hostmaster | .ua | UA | ✅ | | 78 | | Identity Digital | all | | ✅ | | 79 | | IIS | .se, .nu | SE | ✅ | | 80 | | HKIRC | .hk | HK | ✅ | | 81 | | NASK | .pl | PL | ✅ | | 82 | | Namingo | all | | ✅ | | 83 | | NIC Chile | .cl | | ✅ | | 84 | | NIC Mexico | .mx | MX | ✅ | | 85 | | NIC.LV | .lv | LV | ✅ | | 86 | | NORID | .no | NO | ✅ | | 87 | | .PT | .pt | PT | ✅ | | 88 | | Registro.it | .it | IT | ✅ | | 89 | | RoTLD | .ro | | ✅ | | 90 | | RyCE | all | | ✅ | | 91 | | SIDN | all | | ✅ | | 92 | | SWITCH | .ch, .li | | ✅ | | 93 | | Traficom | .fi | FI | ✅ | only org contacts | 94 | | Verisign | all | VRSN | ✅ | | 95 | | ZADNA | .za | | ✅ | | 96 | | ZDNS | all | | ✅ | | 97 | 98 | ### Integration with billing systems 99 | 100 | Would you like to see any registry added as a WHMCS/FOSSBilling module? Or an EPP module for any other billing system? Simply create an [issue](https://github.com/getpinga/tembo/issues) in this project and let us know. 101 | 102 | #### WHMCS 103 | 104 | | Registry | TLDs | Status | Project | 105 | |----------|----------|----------|----------| 106 | | Generic RFC EPP | any | ✅ | [whmcs-epp-rfc](https://github.com/getpinga/whmcs-epp-rfc) | 107 | | Hostmaster | .ua | ✅ | [whmcs-epp-ua](https://github.com/getpinga/whmcs-epp-ua) | 108 | | EURid | .eu | ✅ | [whmcs-epp-eurid](https://github.com/getpinga/whmcs-epp-eurid) | 109 | 110 | #### FOSSBilling 111 | 112 | | Registry | TLDs | Status | Project | 113 | |----------|----------|----------|----------| 114 | | Generic RFC EPP | any | ✅ | [fossbilling-epp-rfc](https://github.com/getpinga/fossbilling-epp-rfc) | 115 | | AFNIC | .fr/others | ✅ | [fossbilling-epp-fr](https://github.com/getpinga/fossbilling-epp-fr) | 116 | | Caucasus Online | .ge | ✅ | [fossbilling-epp-ge](https://github.com/getpinga/fossbilling-epp-ge) | 117 | | FRED | .cz/any | ✅ | [fossbilling-epp-fred](https://github.com/getpinga/fossbilling-epp-fred) | 118 | | Hostmaster | .ua | ✅ | [fossbilling-epp-ua](https://github.com/getpinga/fossbilling-epp-ua) | 119 | 120 | ## Documentation 121 | 122 | ### Installation 123 | 124 | To begin, follow these steps for setting up the EPP Client. This installation process is optimized for a VPS running Ubuntu 22.04/24.04 or Debian 12. 125 | 126 | #### 1. Install PHP 127 | 128 | Make sure PHP is installed on your server. Use the appropriate commands for your operating system. 129 | 130 | ```bash 131 | apt install -y curl software-properties-common ufw 132 | add-apt-repository ppa:ondrej/php 133 | apt update 134 | apt install -y bzip2 composer git net-tools php8.3 php8.3-bz2 php8.3-cli php8.3-common php8.3-curl php8.3-fpm php8.3-gd php8.3-gmp php8.3-imagick php8.3-intl php8.3-mbstring php8.3-opcache php8.3-readline php8.3-soap php8.3-xml unzip wget whois 135 | ``` 136 | 137 | #### 2. Install Tembo Package 138 | 139 | Navigate to your project directory and run the following command: 140 | 141 | ```bash 142 | composer require pinga/tembo 143 | ``` 144 | 145 | #### 3. Configure Access to the Registry 146 | 147 | Edit the `examples/Connection.php` file to configure your registry access credentials. 148 | If the registry requires SSL certificates and you don't have them, refer to the troubleshooting section for steps to generate `cert.pem` and `key.pem`. 149 | 150 | #### Using the EPP Client 151 | 152 | - You can use the commands provided in the `examples` directory to interact with the EPP server. 153 | 154 | - Alternatively, include the `Connection.php` file in your project and build your custom application using the `EppClient` class and its functions. 155 | 156 | ### Troubleshooting 157 | 158 | #### EPP Server Access 159 | 160 | If you're unsure whether your system can access the EPP server, you can test the connection using OpenSSL. Try one or both of the following commands: 161 | 162 | 1. Basic Connectivity Test: 163 | 164 | ```bash 165 | openssl s_client -showcerts -connect epp.example.com:700 166 | ``` 167 | 168 | 2. Test with Client Certificates: 169 | 170 | ```bash 171 | openssl s_client -connect epp.example.com:700 -CAfile cacert.pem -cert cert.pem -key key.pem 172 | ``` 173 | 174 | Replace `epp.example.com` with your EPP server's hostname and adjust the paths to your certificate files (`cacert.pem`, `cert.pem`, and `key.pem`) as needed. These tests can help identify issues with SSL/TLS configurations or network connectivity. 175 | 176 | #### Generating an SSL Certificate and Key 177 | 178 | If you do not have an SSL certificate and private key for secure communication with the registry, you can generate one using OpenSSL. 179 | 180 | ```bash 181 | openssl genrsa -out key.pem 2048 182 | openssl req -new -x509 -key key.pem -out cert.pem -days 365 183 | ``` 184 | 185 | **Note:** For production environments, it's recommended to use a certificate signed by a trusted Certificate Authority (CA) instead of a self-signed certificate. 186 | 187 | #### EPP-over-HTTPS Issues 188 | 189 | If you experience login or other issues with EPP-over-HTTPS registries such as `.eu`, `.fi`, `.hr`, `.it`, or `.lv`, it might be caused by a corrupted or outdated cookie file. Follow these steps to fix it: 190 | 191 | ```bash 192 | rm -f /tmp/eppcookie.txt 193 | ``` 194 | 195 | After deleting the cookie file, try logging in again. This will force the creation of a new cookie file and may resolve the issue. 196 | 197 | #### Need More Help? 198 | 199 | If the steps above don’t resolve your issue, refer to the EPP Client logs (`/path/to/tembo/log`) to identify the specific problem. 200 | 201 | ### Benchmarking an EPP Server 202 | 203 | To run tests against an EPP server using the Tembo EPP client, follow these steps: 204 | 205 | #### 1. Configure Your Connection 206 | 207 | Edit the file `benchmark/Connection.php` - this file should contain the connection details for the server you want to test. It uses the same format as `examples/Connection.php`. 208 | 209 | #### 2. Run the Benchmark 210 | 211 | From the root directory, run `php benchmark/Benchmark.php` - this will execute a series of domain check commands to test your server’s response and performance. 212 | 213 | #### 3. Customize the Benchmark 214 | 215 | You can modify `benchmark/Benchmark.php` to: 216 | - Add your own EPP commands 217 | - Change the number of requests 218 | - Adjust the test logic 219 | 220 | Use this script as a starting point to test and tune your EPP server setup. 221 | 222 | ## Support 223 | 224 | Your feedback and inquiries are invaluable to Namingo's evolutionary journey. If you need support, have questions, or want to contribute your thoughts: 225 | 226 | - **Email**: Feel free to reach out directly at [help@namingo.org](mailto:help@namingo.org). 227 | 228 | - **Discord**: Or chat with us on our [Discord](https://discord.gg/97R9VCrWgc) channel. 229 | 230 | - **GitHub Issues**: For bug reports or feature requests, please use the [Issues](https://github.com/getnamingo/epp-client/issues) section of our GitHub repository. 231 | 232 | - **GitHub Discussions**: For general discussions, ideas, or to connect with our community, visit the [Discussion](https://github.com/getnamingo/epp-client/discussions) page on our GitHub project. 233 | 234 | We appreciate your involvement and patience as Namingo continues to grow and adapt. 235 | 236 | ## 💖 Support This Project 237 | 238 | If you find Namingo EPP Client useful, consider donating: 239 | 240 | - [Donate via Stripe](https://donate.stripe.com/7sI2aI4jV3Offn28ww) 241 | - BTC: `bc1q9jhxjlnzv0x4wzxfp8xzc6w289ewggtds54uqa` 242 | - ETH: `0x330c1b148368EE4B8756B176f1766d52132f0Ea8` 243 | 244 | ## Licensing 245 | 246 | Namingo EPP Client is licensed under the MIT License. -------------------------------------------------------------------------------- /benchmark/Benchmark.php: -------------------------------------------------------------------------------- 1 | logout(); 48 | } catch (\Pinga\Tembo\Exception\EppException $e) { 49 | echo "Error : " . $e->getMessage() . PHP_EOL; 50 | } catch (Throwable $e) { 51 | echo "Error : " . $e->getMessage() . PHP_EOL; 52 | } 53 | -------------------------------------------------------------------------------- /benchmark/Connection.php: -------------------------------------------------------------------------------- 1 | 'https://registry.example.com/epp', 21 | 'host' => 'epp.example.com', 22 | //For EPP-over-HTTPS , port is usually 443 23 | 'port' => 700, 24 | 'timeout' => 30, 25 | 'tls' => '1.2', // Change to 1.3 if required 26 | 'bind' => false, 27 | 'bindip' => '1.2.3.4:0', 28 | 'verify_peer' => false, 29 | 'verify_peer_name' => false, 30 | //For EPP-over-HTTPS , change false to 2 31 | 'verify_host' => false, 32 | 'cafile' => '', 33 | 'local_cert' => '/root/tembo/cert.pem', 34 | 'local_pk' => '/root/tembo/key.pem', 35 | 'passphrase' => '', 36 | 'allow_self_signed' => true 37 | ); 38 | $epp->connect($info); 39 | $login = $epp->login(array( 40 | 'clID' => 'testregistrar1', 41 | 'pw' => 'testpassword1', 42 | //'newpw' => 'testpassword2', 43 | 'prefix' => 'tembo' 44 | )); 45 | if (array_key_exists('error', $login)) { 46 | throw new RuntimeException('Login Error: ' . $login['error']); 47 | } else { 48 | echo 'Login Result: ' . $login['code'] . ': ' . $login['msg'][0] . PHP_EOL; 49 | } 50 | return $epp; 51 | } catch(\Pinga\Tembo\Exception\EppException $e) { 52 | echo "Error : ".$e->getMessage() . PHP_EOL; 53 | } catch(Throwable $e) { 54 | echo "Error : ".$e->getMessage() . PHP_EOL; 55 | } 56 | } -------------------------------------------------------------------------------- /benchmark/Helpers.php: -------------------------------------------------------------------------------- 1 | $domains); 31 | $domainCheck = $epp->domainCheck($params); 32 | 33 | if (array_key_exists('error', $domainCheck)) { 34 | echo 'DomainCheck Error: ' . $domainCheck['error'] . PHP_EOL; 35 | } else { 36 | echo "DomainCheck result: " . $domainCheck['code'] . ": " . $domainCheck['msg'] . PHP_EOL; 37 | $x = 1; 38 | foreach ($domainCheck['domains'] as $domain) { 39 | if ($domain['avail']) { 40 | echo "Domain " . $x . ": " . $domain['name'] . " is available" . PHP_EOL; 41 | } else { 42 | echo "Domain " . $x . ": " . $domain['name'] . " is not available because: " . $domain['reason'] . PHP_EOL; 43 | } 44 | $x++; 45 | } 46 | } 47 | } catch (\Pinga\Tembo\Exception\EppException $e) { 48 | echo "Error : " . $e->getMessage() . PHP_EOL; 49 | } catch (Throwable $e) { 50 | echo "Error : " . $e->getMessage() . PHP_EOL; 51 | } 52 | } 53 | 54 | // Function to perform domain create operation 55 | function performDomainCreate($epp, $domain) { 56 | try { 57 | $params = array( 58 | 'domainname' => $domain, 59 | 'period' => 1, 60 | 'nss' => array('ns1.example.com','ns2.example.com'), 61 | 'registrant' => 'tembo007', 62 | 'contacts' => array( 63 | 'admin' => 'tembo007', 64 | 'tech' => 'tembo007', 65 | 'billing' => 'tembo007' 66 | ), 67 | 'authInfoPw' => 'Domainpw123@' 68 | ); 69 | $domainCreate = $epp->domainCreate($params); 70 | 71 | if (array_key_exists('error', $domainCreate)) { 72 | echo 'DomainCreate Error: ' . $domainCreate['error'] . PHP_EOL; 73 | } else { 74 | echo 'DomainCreate Result: ' . $domainCreate['code'] . ': ' . $domainCreate['msg'] . PHP_EOL; 75 | echo 'New Domain: ' . $domainCreate['name'] . PHP_EOL; 76 | echo 'Created On: ' . $domainCreate['crDate'] . PHP_EOL; 77 | echo 'Expires On: ' . $domainCreate['exDate'] . PHP_EOL; 78 | } 79 | } catch (\Pinga\Tembo\Exception\EppException $e) { 80 | echo "Error : " . $e->getMessage() . PHP_EOL; 81 | } catch (Throwable $e) { 82 | echo "Error : " . $e->getMessage() . PHP_EOL; 83 | } 84 | } 85 | 86 | // Function to perform domain info operation 87 | function performDomainInfo($epp, $domain) { 88 | try { 89 | $params = array( 90 | 'domainname' => $domain, 91 | 'authInfoPw' => 'P@ssword123!' 92 | ); 93 | $domainInfo = $epp->domainInfo($params); 94 | 95 | if (array_key_exists('error', $domainInfo)) { 96 | echo 'DomainInfo Error: ' . $domainInfo['error'] . PHP_EOL; 97 | } else { 98 | echo 'DomainInfo Result: ' . $domainInfo['code'] . ': ' . $domainInfo['msg'] . PHP_EOL; 99 | echo 'Name: ' . $domainInfo['name'] . PHP_EOL; 100 | echo 'ROID: ' . $domainInfo['roid'] . PHP_EOL; 101 | $status = $domainInfo['status'] ?? 'No status available'; 102 | if (is_array($status)) { 103 | echo 'Status: ' . implode(', ', $status) . PHP_EOL; 104 | } else { 105 | echo 'Status: ' . $status . PHP_EOL; 106 | } 107 | echo 'Registrant: ' . $domainInfo['registrant'] . PHP_EOL; 108 | 109 | $contact_types = array("admin", "billing", "tech"); 110 | foreach ($contact_types as $type) { 111 | $contact = array_values(array_filter($domainInfo['contact'], function($c) use ($type) { 112 | return $c["type"] == $type; 113 | })); 114 | if (count($contact) > 0) { 115 | $type = ucfirst($type); 116 | echo $type . ": " . $contact[0]["id"] . "\n"; 117 | } 118 | } 119 | asort($domainInfo['ns']); 120 | foreach ($domainInfo['ns'] as $server) { 121 | echo "Name Server: $server\n"; 122 | } 123 | asort($domainInfo['host']); 124 | foreach ($domainInfo['host'] as $host) { 125 | echo "Host: $host\n"; 126 | } 127 | echo 'Current Registrar: ' . $domainInfo['clID'] . PHP_EOL; 128 | echo 'Original Registrar: ' . $domainInfo['crID'] . PHP_EOL; 129 | echo 'Created On: ' . $domainInfo['crDate'] . PHP_EOL; 130 | echo 'Updated By: ' . $domainInfo['upID'] . PHP_EOL; 131 | echo 'Updated On: ' . $domainInfo['upDate'] . PHP_EOL; 132 | echo 'Expires On: ' . $domainInfo['exDate'] . PHP_EOL; 133 | echo 'Transferred On: ' . $domainInfo['trDate'] . PHP_EOL; 134 | echo 'Password: ' . $domainInfo['authInfo'] . PHP_EOL; 135 | } 136 | } catch (\Pinga\Tembo\Exception\EppException $e) { 137 | echo "Error : " . $e->getMessage() . PHP_EOL; 138 | } catch (Throwable $e) { 139 | echo "Error : " . $e->getMessage() . PHP_EOL; 140 | } 141 | } -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pinga/tembo", 3 | "description": "A simple PHP EPP client", 4 | "license": "MIT", 5 | "type": "library", 6 | "authors": [ 7 | { 8 | "name": "Taras Kondratyuk", 9 | "email": "tk@gepinga.com" 10 | } 11 | ], 12 | "require": { 13 | "php": "^8.2", 14 | "ext-xml": "*", 15 | "monolog/monolog": "^3.6" 16 | }, 17 | "autoload": { 18 | "psr-4": { 19 | "Pinga\\Tembo\\": "src/", 20 | "Pinga\\Tembo\\Exception\\": "src/Exception/" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /examples/Connection.php: -------------------------------------------------------------------------------- 1 | 'https://registry.example.com/epp', 21 | 'host' => 'epp.example.com', 22 | //For EPP-over-HTTPS , port is usually 443 23 | 'port' => 700, 24 | 'timeout' => 30, 25 | 'tls' => '1.2', // Change to 1.3 if required 26 | 'bind' => false, 27 | 'bindip' => '1.2.3.4:0', 28 | 'verify_peer' => false, 29 | 'verify_peer_name' => false, 30 | //For EPP-over-HTTPS , change false to 2 31 | 'verify_host' => false, 32 | 'cafile' => '', 33 | 'local_cert' => '/root/tembo/cert.pem', 34 | 'local_pk' => '/root/tembo/key.pem', 35 | 'passphrase' => '', 36 | 'allow_self_signed' => true 37 | ); 38 | $epp->connect($info); 39 | $login = $epp->login(array( 40 | 'clID' => 'testregistrar1', 41 | 'pw' => 'testpassword1', 42 | //'newpw' => 'testpassword2', 43 | 'prefix' => 'tembo' 44 | )); 45 | if (array_key_exists('error', $login)) { 46 | echo 'Login Error: ' . $login['error'] . PHP_EOL; 47 | exit(); 48 | } else { 49 | echo 'Login Result: ' . $login['code'] . ': ' . $login['msg'][0] . PHP_EOL; 50 | } 51 | return $epp; 52 | } catch(\Pinga\Tembo\Exception\EppException $e) { 53 | echo "Error : ".$e->getMessage() . PHP_EOL; 54 | } catch(Throwable $e) { 55 | echo "Error : ".$e->getMessage() . PHP_EOL; 56 | } 57 | } -------------------------------------------------------------------------------- /examples/Connection2.php: -------------------------------------------------------------------------------- 1 | 'https://registry.example.com/epp', 21 | 'host' => 'epp.example.com', 22 | //For EPP-over-HTTPS , port is usually 443 23 | 'port' => 700, 24 | 'timeout' => 30, 25 | 'tls' => '1.2', // Change to 1.3 if required 26 | 'bind' => false, 27 | 'bindip' => '1.2.3.4:0', 28 | 'verify_peer' => false, 29 | 'verify_peer_name' => false, 30 | //For EPP-over-HTTPS , change false to 2 31 | 'verify_host' => false, 32 | 'cafile' => '', 33 | 'local_cert' => '/root/tembo/cert.pem', 34 | 'local_pk' => '/root/tembo/key.pem', 35 | 'passphrase' => '', 36 | 'allow_self_signed' => true 37 | ); 38 | $epp->connect($info); 39 | $login = $epp->login(array( 40 | 'clID' => 'testregistrar2', 41 | 'pw' => 'testpassword2', 42 | //'newpw' => 'testpassword3', 43 | 'prefix' => 'tembo' 44 | )); 45 | if (array_key_exists('error', $login)) { 46 | echo 'Login Error: ' . $login['error'] . PHP_EOL; 47 | exit(); 48 | } else { 49 | echo 'Login Result: ' . $login['code'] . ': ' . $login['msg'][0] . PHP_EOL; 50 | } 51 | return $epp; 52 | } catch(\Pinga\Tembo\Exception\EppException $e) { 53 | echo "Error : ".$e->getMessage() . PHP_EOL; 54 | } catch(Throwable $e) { 55 | echo "Error : ".$e->getMessage() . PHP_EOL; 56 | } 57 | } -------------------------------------------------------------------------------- /examples/ConnectionDB.php: -------------------------------------------------------------------------------- 1 | prepare("SELECT local_cert, local_pk, passphrase FROM epp_credentials WHERE id = :id"); 19 | $stmt->execute(array('id' => 1)); 20 | $result = $stmt->fetch(PDO::FETCH_ASSOC); 21 | 22 | $epp = EppRegistryFactory::create($registry); 23 | $info = array( 24 | 'host' => 'epp.example.com', 25 | 'port' => 700, 26 | 'timeout' => 30, 27 | 'tls' => '1.3', 28 | 'bind' => false, 29 | 'bindip' => '1.2.3.4:0', 30 | 'verify_peer' => false, 31 | 'verify_peer_name' => false, 32 | 'verify_host' => false, 33 | 'cafile' => '', 34 | 'local_cert' => $result['local_cert'], 35 | 'local_pk' => $result['local_pk'], 36 | 'passphrase' => $result['passphrase'], 37 | 'allow_self_signed' => true 38 | ); 39 | $epp->connect($info); 40 | $login = $epp->login(array( 41 | 'clID' => 'testregistrar1', 42 | 'pw' => 'testpassword1', 43 | //'newpw' => 'testpassword2', 44 | 'prefix' => 'tembo' 45 | )); 46 | if (array_key_exists('error', $login)) { 47 | echo 'Login Error: ' . $login['error'] . PHP_EOL; 48 | exit(); 49 | } else { 50 | echo 'Login Result: ' . $login['code'] . ': ' . $login['msg'][0] . PHP_EOL; 51 | } 52 | return $epp; 53 | } catch(\Pinga\Tembo\Exception\EppException $e) { 54 | echo "Error : ".$e->getMessage() . PHP_EOL; 55 | } catch(Throwable $e) { 56 | echo "Error : ".$e->getMessage() . PHP_EOL; 57 | } 58 | } -------------------------------------------------------------------------------- /examples/ContactCheck.php: -------------------------------------------------------------------------------- 1 | array('tembo007', 'tembo009') 20 | ); 21 | $contactCheck = $epp->contactCheck($params); 22 | 23 | if (array_key_exists('error', $contactCheck)) 24 | { 25 | echo 'ContactCheck Error: ' . $contactCheck['error'] . PHP_EOL; 26 | } 27 | else 28 | { 29 | echo "ContactCheck result: " . $contactCheck['code'] . ": " . $contactCheck['msg'] . PHP_EOL; 30 | $x=1; 31 | foreach ($contactCheck['contacts'] as $contact) 32 | { 33 | if ($contact['avail']) 34 | { 35 | echo "Contact ".$x.": ID " . $contact['id'] . " is available" . PHP_EOL; 36 | } 37 | else 38 | { 39 | if (!empty($contact['reason'])) 40 | { 41 | echo "Contact " . $x . ": ID " . $contact['id'] . " is not available because: " . $contact['reason'] . PHP_EOL; 42 | } 43 | else 44 | { 45 | echo "Contact " . $x . ": ID " . $contact['id'] . " is not available" . PHP_EOL; 46 | } 47 | } 48 | $x++; 49 | } 50 | } 51 | 52 | $logout = $epp->logout(); 53 | 54 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 55 | } catch(\Pinga\Tembo\Exception\EppException $e) { 56 | echo "Error : ".$e->getMessage() . PHP_EOL; 57 | } catch(Throwable $e) { 58 | echo "Error : ".$e->getMessage() . PHP_EOL; 59 | } -------------------------------------------------------------------------------- /examples/ContactCreate.php: -------------------------------------------------------------------------------- 1 | 'tembo007', 20 | 'type' => 'int', 21 | 'firstname' => 'Svyatoslav', 22 | 'lastname' => 'Petrenko', 23 | 'companyname' => 'TOV TEMBO', 24 | 'address1' => 'vul. Stryiska 1', 25 | 'address2' => 'kv. 1', 26 | 'city' => 'Lviv', 27 | 'state' => 'Lviv', 28 | 'postcode' => '48000', 29 | 'country' => 'UA', 30 | 'fullphonenumber' => '+380.1234567', 31 | 'email' => 'test@tembo.ua', 32 | 'authInfoPw' => 'ABCLviv@345', 33 | //'euType' => 'tech', 34 | //'nin_type' => 'person', 35 | //'nin' => '1234567789', 36 | ); 37 | $contactCreate = $epp->contactCreate($params); 38 | 39 | if (array_key_exists('error', $contactCreate)) 40 | { 41 | echo 'ContactCreate Error: ' . $contactCreate['error'] . PHP_EOL; 42 | } 43 | else 44 | { 45 | echo 'ContactCreate Result: ' . $contactCreate['code'] . ': ' . $contactCreate['msg'] . PHP_EOL . 'New Contact ID: ' . $contactCreate['id'] . PHP_EOL; 46 | } 47 | 48 | $logout = $epp->logout(); 49 | 50 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 51 | } catch(\Pinga\Tembo\Exception\EppException $e) { 52 | echo "Error : ".$e->getMessage() . PHP_EOL; 53 | } catch(Throwable $e) { 54 | echo "Error : ".$e->getMessage() . PHP_EOL; 55 | } -------------------------------------------------------------------------------- /examples/ContactDelete.php: -------------------------------------------------------------------------------- 1 | 'tembo001' 20 | ); 21 | $contactDelete = $epp->contactDelete($params); 22 | 23 | if (array_key_exists('error', $contactDelete)) 24 | { 25 | echo 'ContactDelete Error: ' . $contactDelete['error'] . PHP_EOL; 26 | } 27 | else 28 | { 29 | echo "ContactDelete result: " . $contactDelete['code'] . ": " . $contactDelete['msg'] . PHP_EOL; 30 | } 31 | 32 | $logout = $epp->logout(); 33 | 34 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 35 | } catch(\Pinga\Tembo\Exception\EppException $e) { 36 | echo "Error : ".$e->getMessage() . PHP_EOL; 37 | } catch(Throwable $e) { 38 | echo "Error : ".$e->getMessage() . PHP_EOL; 39 | } -------------------------------------------------------------------------------- /examples/ContactInfo.php: -------------------------------------------------------------------------------- 1 | 'tembo007' 20 | ); 21 | $contactInfo = $epp->contactInfo($params); 22 | 23 | if (array_key_exists('error', $contactInfo)) 24 | { 25 | echo 'ContactInfo Error: ' . $contactInfo['error'] . PHP_EOL; 26 | } 27 | else 28 | { 29 | echo 'ContactInfo Result: ' . $contactInfo['code'] . ': ' . $contactInfo['msg'] . PHP_EOL; 30 | echo 'ID: ' . $contactInfo['id'] . PHP_EOL; 31 | echo 'ROID: ' . $contactInfo['roid'] . PHP_EOL; 32 | echo 'Name: ' . $contactInfo['name'] . PHP_EOL; 33 | echo 'Org: ' . $contactInfo['org'] . PHP_EOL; 34 | echo 'Street 1: ' . $contactInfo['street1'] . PHP_EOL; 35 | echo 'Street 2: ' . $contactInfo['street2'] . PHP_EOL; 36 | echo 'Street 3: ' . $contactInfo['street3'] . PHP_EOL; 37 | echo 'City: ' . $contactInfo['city'] . PHP_EOL; 38 | echo 'State: ' . $contactInfo['state'] . PHP_EOL; 39 | echo 'Postal: ' . $contactInfo['postal'] . PHP_EOL; 40 | echo 'Country: ' . $contactInfo['country'] . PHP_EOL; 41 | echo 'Voice: ' . $contactInfo['voice'] . PHP_EOL; 42 | echo 'Fax: ' . $contactInfo['fax'] . PHP_EOL; 43 | echo 'Email: ' . $contactInfo['email'] . PHP_EOL; 44 | echo 'Current Registrar: ' . $contactInfo['clID'] . PHP_EOL; 45 | echo 'Original Registrar: ' . $contactInfo['crID'] . PHP_EOL; 46 | echo 'Created On: ' . $contactInfo['crDate'] . PHP_EOL; 47 | echo 'Updated By: ' . $contactInfo['upID'] . PHP_EOL; 48 | echo 'Updated On: ' . $contactInfo['upDate'] . PHP_EOL; 49 | echo 'Password: ' . $contactInfo['authInfo'] . PHP_EOL; 50 | echo 'Status: ' . $contactInfo['status'][1] . PHP_EOL; 51 | } 52 | 53 | $logout = $epp->logout(); 54 | 55 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 56 | } catch(\Pinga\Tembo\Exception\EppException $e) { 57 | echo "Error : ".$e->getMessage() . PHP_EOL; 58 | } catch(Throwable $e) { 59 | echo "Error : ".$e->getMessage() . PHP_EOL; 60 | } -------------------------------------------------------------------------------- /examples/ContactUpdate.php: -------------------------------------------------------------------------------- 1 | 'tembo007', 20 | 'type' => 'int', 21 | 'firstname' => 'Svyatoslav', 22 | 'lastname' => 'Petrenko', 23 | 'companyname' => 'TOV TEMBO', 24 | 'address1' => 'vul. Stryiska 100', 25 | 'address2' => 'kv. 2', 26 | 'city' => 'Lviv', 27 | 'state' => 'Lviv', 28 | 'postcode' => '48000', 29 | 'country' => 'UA', 30 | 'fullphonenumber' => '+380.7654321', 31 | 'email' => 'test@tembo.lviv.ua', 32 | 'authInfoPw' => 'ABCLviv@345' 33 | ); 34 | $contactUpdate = $epp->contactUpdate($params); 35 | 36 | if (array_key_exists('error', $contactUpdate)) 37 | { 38 | echo 'contactUpdate Error: ' . $contactUpdate['error'] . PHP_EOL; 39 | } 40 | else 41 | { 42 | echo 'contactUpdate Result: ' . $contactUpdate['code'] . ': ' . $contactUpdate['msg'] . PHP_EOL; 43 | } 44 | 45 | $logout = $epp->logout(); 46 | 47 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 48 | } catch(\Pinga\Tembo\Exception\EppException $e) { 49 | echo "Error : ".$e->getMessage() . PHP_EOL; 50 | } catch(Throwable $e) { 51 | echo "Error : ".$e->getMessage() . PHP_EOL; 52 | } -------------------------------------------------------------------------------- /examples/DomainCheck.php: -------------------------------------------------------------------------------- 1 | array('test.example','tembo.example') 20 | ); 21 | $domainCheck = $epp->domainCheck($params); 22 | 23 | if (array_key_exists('error', $domainCheck)) 24 | { 25 | echo 'DomainCheck Error: ' . $domainCheck['error'] . PHP_EOL; 26 | } 27 | else 28 | { 29 | echo "DomainCheck result: " . $domainCheck['code'] . ": " . $domainCheck['msg'] . PHP_EOL; 30 | $x=1; 31 | foreach ($domainCheck['domains'] as $domain) 32 | { 33 | if ($domain['avail']) 34 | { 35 | echo "Domain ".$x.": " . $domain['name'] . " is available" . PHP_EOL; 36 | } 37 | else 38 | { 39 | echo "Domain ".$x.": " . $domain['name'] . " is not available because: " . $domain['reason'] . PHP_EOL; 40 | } 41 | $x++; 42 | } 43 | } 44 | 45 | $logout = $epp->logout(); 46 | 47 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 48 | } catch(\Pinga\Tembo\Exception\EppException $e) { 49 | echo "Error : ".$e->getMessage() . PHP_EOL; 50 | } catch(Throwable $e) { 51 | echo "Error : ".$e->getMessage() . PHP_EOL; 52 | } -------------------------------------------------------------------------------- /examples/DomainCheckClaims.php: -------------------------------------------------------------------------------- 1 | 'test.example' 20 | ); 21 | $domainCheckClaims = $epp->domainCheckClaims($params); 22 | 23 | if (array_key_exists('error', $domainCheckClaims)) 24 | { 25 | echo 'DomainCheckClaims Error: ' . $domainCheckClaims['error'] . PHP_EOL; 26 | } 27 | else 28 | { 29 | echo "DomainCheckClaims result: " . $domainCheckClaims['code'] . ": " . $domainCheckClaims['msg'] . PHP_EOL; 30 | echo "Domain Name: " . $domainCheckClaims['domain'] . PHP_EOL; 31 | echo "Domain Status: " . $domainCheckClaims['status'] . PHP_EOL; 32 | echo "Domain Phase: " . $domainCheckClaims['phase'] . PHP_EOL; 33 | echo "Domain Claim Key: " . $domainCheckClaims['claimKey'] . PHP_EOL; 34 | } 35 | 36 | $logout = $epp->logout(); 37 | 38 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 39 | } catch(\Pinga\Tembo\Exception\EppException $e) { 40 | echo "Error : ".$e->getMessage() . PHP_EOL; 41 | } catch(Throwable $e) { 42 | echo "Error : ".$e->getMessage() . PHP_EOL; 43 | } -------------------------------------------------------------------------------- /examples/DomainCreate.php: -------------------------------------------------------------------------------- 1 | 'test.example', 20 | 'period' => 1, 21 | // For TLDs that require the element (e.g., when assigning nameservers with specific IP addresses), 22 | // comment out the next line and uncomment the one below to include hostAttr details in the EPP request. 23 | 'nss' => array('ns1.google.com','ns2.google.com'), 24 | /*'nss' => array( 25 | array( 26 | 'hostName' => 'ns.test.it', 27 | 'ipv4' => '192.168.100.10' 28 | ), 29 | array( 30 | 'hostName' => 'ns2.test.it', 31 | 'ipv4' => '192.168.100.20' 32 | ), 33 | array( 34 | 'hostName' => 'ns3.foo.com' 35 | ) 36 | ),*/ 37 | 'registrant' => 'tembo007', 38 | 'contacts' => array( 39 | 'admin' => 'tembo007', 40 | 'tech' => 'tembo007', 41 | 'billing' => 'tembo007' 42 | ), 43 | 'authInfoPw' => 'Domainpw123@' 44 | ); 45 | $domainCreate = $epp->domainCreate($params); 46 | 47 | if (array_key_exists('error', $domainCreate)) 48 | { 49 | echo 'DomainCreate Error: ' . $domainCreate['error'] . PHP_EOL; 50 | } 51 | else 52 | { 53 | echo 'DomainCreate Result: ' . $domainCreate['code'] . ': ' . $domainCreate['msg'] . PHP_EOL; 54 | echo 'New Domain: ' . $domainCreate['name'] . PHP_EOL; 55 | echo 'Created On: ' . $domainCreate['crDate'] . PHP_EOL; 56 | echo 'Expires On: ' . $domainCreate['exDate'] . PHP_EOL; 57 | } 58 | 59 | $logout = $epp->logout(); 60 | 61 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 62 | } catch(\Pinga\Tembo\Exception\EppException $e) { 63 | echo "Error : ".$e->getMessage() . PHP_EOL; 64 | } catch(Throwable $e) { 65 | echo "Error : ".$e->getMessage() . PHP_EOL; 66 | } -------------------------------------------------------------------------------- /examples/DomainCreateClaims.php: -------------------------------------------------------------------------------- 1 | 'test.example', 20 | 'period' => 1, 21 | 'nss' => array('ns1.google.com','ns2.google.com'), 22 | 'registrant' => 'tembo007', 23 | 'contacts' => array( 24 | 'admin' => 'tembo007', 25 | 'tech' => 'tembo007', 26 | 'billing' => 'tembo007' 27 | ), 28 | 'authInfoPw' => 'Domainpw123@', 29 | 'noticeID' => 'ABCDE1234FGHIJK5678', 30 | 'notAfter' => '2023-02-24T09:30:00.0Z', 31 | 'acceptedDate' => '2023-02-21T09:30:00.0Z' 32 | ); 33 | $domainCreateClaims = $epp->domainCreateClaims($params); 34 | 35 | if (array_key_exists('error', $domainCreateClaims)) 36 | { 37 | echo 'DomainCreateClaims Error: ' . $domainCreateClaims['error'] . PHP_EOL; 38 | } 39 | else 40 | { 41 | echo 'DomainCreateClaims Result: ' . $domainCreateClaims['code'] . ': ' . $domainCreateClaims['msg'] . PHP_EOL; 42 | echo 'New Domain: ' . $domainCreateClaims['name'] . PHP_EOL; 43 | echo 'Created On: ' . $domainCreateClaims['crDate'] . PHP_EOL; 44 | echo 'Expires On: ' . $domainCreateClaims['exDate'] . PHP_EOL; 45 | } 46 | 47 | $logout = $epp->logout(); 48 | 49 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 50 | } catch(\Pinga\Tembo\Exception\EppException $e) { 51 | echo "Error : ".$e->getMessage() . PHP_EOL; 52 | } catch(Throwable $e) { 53 | echo "Error : ".$e->getMessage() . PHP_EOL; 54 | } -------------------------------------------------------------------------------- /examples/DomainCreateDNSSEC.php: -------------------------------------------------------------------------------- 1 | 'test.example', 20 | 'period' => 1, 21 | 'nss' => array('ns1.google.com','ns2.google.com'), 22 | 'registrant' => 'tembo007', 23 | 'contacts' => array( 24 | 'admin' => 'tembo007', 25 | 'tech' => 'tembo007', 26 | 'billing' => 'tembo007' 27 | ), 28 | 'authInfoPw' => 'Domainpw123@', 29 | 'dnssec_records' => '2', 30 | 'keyTag_1' => '33409', 31 | 'alg_1' => '8', 32 | 'digestType_1' => '1', 33 | 'digest_1' => 'F4D6E26B3483C3D7B3EE17799B0570497FAF33BCB12B9B9CE573DDB491E16948', 34 | 'keyTag_2' => '43409', 35 | 'alg_2' => '8', 36 | 'digestType_2' => '2', 37 | 'digest_2' => 'F3D6E26B3483C3D7B3EE17799B0570497FAF33BCB12B9B9CE573DDB491E16564' 38 | ); 39 | $domainCreateDNSSEC = $epp->domainCreateDNSSEC($params); 40 | 41 | if (array_key_exists('error', $domainCreateDNSSEC)) 42 | { 43 | echo 'DomainCreateDNSSEC Error: ' . $domainCreateDNSSEC['error'] . PHP_EOL; 44 | } 45 | else 46 | { 47 | echo 'DomainCreateDNSSEC Result: ' . $domainCreateDNSSEC['code'] . ': ' . $domainCreateDNSSEC['msg'] . PHP_EOL; 48 | echo 'New Domain: ' . $domainCreateDNSSEC['name'] . PHP_EOL; 49 | echo 'Created On: ' . $domainCreateDNSSEC['crDate'] . PHP_EOL; 50 | echo 'Expires On: ' . $domainCreateDNSSEC['exDate'] . PHP_EOL; 51 | } 52 | 53 | $logout = $epp->logout(); 54 | 55 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 56 | } catch(\Pinga\Tembo\Exception\EppException $e) { 57 | echo "Error : ".$e->getMessage() . PHP_EOL; 58 | } catch(Throwable $e) { 59 | echo "Error : ".$e->getMessage() . PHP_EOL; 60 | } -------------------------------------------------------------------------------- /examples/DomainCreateSunrise.php: -------------------------------------------------------------------------------- 1 | 'test.example', 20 | 'period' => 1, 21 | 'registrant' => 'tembo007', 22 | 'contacts' => array( 23 | 'admin' => 'tembo007', 24 | 'tech' => 'tembo007' 25 | ), 26 | 'authInfoPw' => 'Domainpw123@', 27 | 'encodedSignedMark' => 'INSERT_HERE' 28 | ); 29 | $domainCreateSunrise = $epp->domainCreateSunrise($params); 30 | 31 | if (array_key_exists('error', $domainCreateSunrise)) 32 | { 33 | echo 'DomainCreateSunrise Error: ' . $domainCreateSunrise['error'] . PHP_EOL; 34 | } 35 | else 36 | { 37 | echo 'DomainCreateSunrise Result: ' . $domainCreateSunrise['code'] . ': ' . $domainCreateSunrise['msg'] . PHP_EOL; 38 | echo 'New Domain: ' . $domainCreateSunrise['name'] . PHP_EOL; 39 | echo 'Created On: ' . $domainCreateSunrise['crDate'] . PHP_EOL; 40 | echo 'Expires On: ' . $domainCreateSunrise['exDate'] . PHP_EOL; 41 | } 42 | 43 | $logout = $epp->logout(); 44 | 45 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 46 | } catch(\Pinga\Tembo\Exception\EppException $e) { 47 | echo "Error : ".$e->getMessage() . PHP_EOL; 48 | } catch(Throwable $e) { 49 | echo "Error : ".$e->getMessage() . PHP_EOL; 50 | } -------------------------------------------------------------------------------- /examples/DomainDelete.php: -------------------------------------------------------------------------------- 1 | 'test.example' 20 | ); 21 | $domainDelete = $epp->domainDelete($params); 22 | 23 | if (array_key_exists('error', $domainDelete)) 24 | { 25 | echo 'DomainDelete Error: ' . $domainDelete['error'] . PHP_EOL; 26 | } 27 | else 28 | { 29 | echo "DomainDelete result: " . $domainDelete['code'] . ": " . $domainDelete['msg'] . PHP_EOL; 30 | } 31 | 32 | $logout = $epp->logout(); 33 | 34 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 35 | } catch(\Pinga\Tembo\Exception\EppException $e) { 36 | echo "Error : ".$e->getMessage() . PHP_EOL; 37 | } catch(Throwable $e) { 38 | echo "Error : ".$e->getMessage() . PHP_EOL; 39 | } -------------------------------------------------------------------------------- /examples/DomainInfo.php: -------------------------------------------------------------------------------- 1 | 'test.example', 20 | 'authInfoPw' => 'Domainpw123@' 21 | ); 22 | $domainInfo = $epp->domainInfo($params); 23 | 24 | if (array_key_exists('error', $domainInfo)) 25 | { 26 | echo 'DomainInfo Error: ' . $domainInfo['error'] . PHP_EOL; 27 | } 28 | else 29 | { 30 | echo 'DomainInfo Result: ' . $domainInfo['code'] . ': ' . $domainInfo['msg'] . PHP_EOL; 31 | echo 'Name: ' . $domainInfo['name'] . PHP_EOL; 32 | echo 'ROID: ' . $domainInfo['roid'] . PHP_EOL; 33 | $status = $domainInfo['status'] ?? 'No status available'; 34 | if (is_array($status)) { 35 | echo 'Status: ' . implode(', ', $status) . PHP_EOL; 36 | } else { 37 | echo 'Status: ' . $status . PHP_EOL; 38 | } 39 | echo 'Registrant: ' . $domainInfo['registrant'] . PHP_EOL; 40 | 41 | $contact_types = array("admin", "billing", "tech"); 42 | foreach ($contact_types as $type) { 43 | $contact = array_values(array_filter($domainInfo['contact'], function($c) use ($type) { 44 | return $c["type"] == $type; 45 | })); 46 | if (count($contact) > 0) { 47 | $type = ucfirst($type); 48 | echo $type . ": " . $contact[0]["id"] . "\n"; 49 | } 50 | } 51 | if (isset($domainInfo['ns']) && is_array($domainInfo['ns'])) { 52 | asort($domainInfo['ns']); 53 | foreach ($domainInfo['ns'] as $server) { 54 | echo "Name Server: $server\n"; 55 | } 56 | } else { 57 | echo "No Name Servers available.\n"; 58 | } 59 | 60 | if (isset($domainInfo['host']) && is_array($domainInfo['host'])) { 61 | asort($domainInfo['host']); 62 | foreach ($domainInfo['host'] as $host) { 63 | echo "Host: $host\n"; 64 | } 65 | } else { 66 | echo "No Hosts available.\n"; 67 | } 68 | echo 'Current Registrar: ' . $domainInfo['clID'] . PHP_EOL; 69 | echo 'Original Registrar: ' . $domainInfo['crID'] . PHP_EOL; 70 | echo 'Created On: ' . $domainInfo['crDate'] . PHP_EOL; 71 | echo 'Updated By: ' . $domainInfo['upID'] . PHP_EOL; 72 | echo 'Updated On: ' . $domainInfo['upDate'] . PHP_EOL; 73 | echo 'Expires On: ' . $domainInfo['exDate'] . PHP_EOL; 74 | echo 'Transferred On: ' . $domainInfo['trDate'] . PHP_EOL; 75 | echo 'Password: ' . $domainInfo['authInfo'] . PHP_EOL; 76 | } 77 | 78 | $logout = $epp->logout(); 79 | 80 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 81 | } catch(\Pinga\Tembo\Exception\EppException $e) { 82 | echo "Error : ".$e->getMessage() . PHP_EOL; 83 | } catch(Throwable $e) { 84 | echo "Error : ".$e->getMessage() . PHP_EOL; 85 | } -------------------------------------------------------------------------------- /examples/DomainRenew.php: -------------------------------------------------------------------------------- 1 | 'test.example', 20 | 'regperiod' => 1 21 | ); 22 | $domainRenew = $epp->domainRenew($params); 23 | 24 | if (array_key_exists('error', $domainRenew)) 25 | { 26 | echo 'DomainRenew Error: ' . $domainRenew['error'] . PHP_EOL; 27 | } 28 | else 29 | { 30 | echo "DomainRenew result: " . $domainRenew['code'] . ": " . $domainRenew['msg'] . PHP_EOL; 31 | echo 'Domain Name: ' . $domainRenew['name'] . PHP_EOL; 32 | echo 'New Expiration Date: ' . $domainRenew['exDate'] . PHP_EOL; 33 | } 34 | 35 | $logout = $epp->logout(); 36 | 37 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 38 | } catch(\Pinga\Tembo\Exception\EppException $e) { 39 | echo "Error : ".$e->getMessage() . PHP_EOL; 40 | } catch(Throwable $e) { 41 | echo "Error : ".$e->getMessage() . PHP_EOL; 42 | } -------------------------------------------------------------------------------- /examples/DomainReport.php: -------------------------------------------------------------------------------- 1 | 'test.example' 20 | ); 21 | $domainReport = $epp->domainReport($params); 22 | 23 | if (array_key_exists('error', $domainReport)) 24 | { 25 | echo 'DomainReport Error: ' . $domainReport['error'] . PHP_EOL; 26 | } 27 | else 28 | { 29 | echo "DomainReport result: " . $domainReport['code'] . ": " . $domainReport['msg'] . PHP_EOL; 30 | } 31 | 32 | $logout = $epp->logout(); 33 | 34 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 35 | } catch(\Pinga\Tembo\Exception\EppException $e) { 36 | echo "Error : ".$e->getMessage() . PHP_EOL; 37 | } catch(Throwable $e) { 38 | echo "Error : ".$e->getMessage() . PHP_EOL; 39 | } -------------------------------------------------------------------------------- /examples/DomainRestore.php: -------------------------------------------------------------------------------- 1 | 'test.example' 20 | ); 21 | $domainRestore = $epp->domainRestore($params); 22 | 23 | if (array_key_exists('error', $domainRestore)) 24 | { 25 | echo 'DomainRestore Error: ' . $domainRestore['error'] . PHP_EOL; 26 | } 27 | else 28 | { 29 | echo "DomainRestore result: " . $domainRestore['code'] . ": " . $domainRestore['msg'] . PHP_EOL; 30 | } 31 | 32 | $logout = $epp->logout(); 33 | 34 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 35 | } catch(\Pinga\Tembo\Exception\EppException $e) { 36 | echo "Error : ".$e->getMessage() . PHP_EOL; 37 | } catch(Throwable $e) { 38 | echo "Error : ".$e->getMessage() . PHP_EOL; 39 | } -------------------------------------------------------------------------------- /examples/DomainTransfer.php: -------------------------------------------------------------------------------- 1 | 'test.example', 20 | 'years' => 1, 21 | 'authInfoPw' => 'Domainpw123@', 22 | 'op' => 'request' 23 | ); 24 | $domainTransfer = $epp->domainTransfer($params); 25 | 26 | if (array_key_exists('error', $domainTransfer)) { 27 | echo 'DomainTransfer Error: ' . $domainTransfer['error'] . PHP_EOL; 28 | } else { 29 | if (array_key_exists('code', $domainTransfer) && array_key_exists('msg', $domainTransfer)) { 30 | echo 'DomainTransfer Result: ' . $domainTransfer['code'] . ': ' . $domainTransfer['msg'] . PHP_EOL; 31 | } 32 | if (array_key_exists('name', $domainTransfer)) { 33 | echo 'Name: ' . $domainTransfer['name'] . PHP_EOL; 34 | } 35 | if (array_key_exists('trStatus', $domainTransfer)) { 36 | echo 'Transfer Status: ' . $domainTransfer['trStatus'] . PHP_EOL; 37 | } 38 | if (array_key_exists('reID', $domainTransfer)) { 39 | echo 'Gaining Registrar: ' . $domainTransfer['reID'] . PHP_EOL; 40 | } 41 | if (array_key_exists('reDate', $domainTransfer)) { 42 | echo 'Requested On: ' . $domainTransfer['reDate'] . PHP_EOL; 43 | } 44 | if (array_key_exists('acID', $domainTransfer)) { 45 | echo 'Losing Registrar: ' . $domainTransfer['acID'] . PHP_EOL; 46 | } 47 | if (array_key_exists('acDate', $domainTransfer)) { 48 | echo 'Transfer Confirmed On: ' . $domainTransfer['acDate'] . PHP_EOL; 49 | } 50 | if (array_key_exists('exDate', $domainTransfer)) { 51 | echo 'New Expiration Date: ' . $domainTransfer['exDate'] . PHP_EOL; 52 | } 53 | } 54 | 55 | $logout = $epp->logout(); 56 | 57 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 58 | } catch(\Pinga\Tembo\Exception\EppException $e) { 59 | echo "Error : ".$e->getMessage() . PHP_EOL; 60 | } catch(Throwable $e) { 61 | echo "Error : ".$e->getMessage() . PHP_EOL; 62 | } -------------------------------------------------------------------------------- /examples/DomainUpdateAuthinfo.php: -------------------------------------------------------------------------------- 1 | 'test.example', 20 | 'authInfo' => 'P@ssword123!' 21 | ); 22 | $domainUpdateAuthinfo = $epp->domainUpdateAuthinfo($params); 23 | 24 | if (array_key_exists('error', $domainUpdateAuthinfo)) 25 | { 26 | echo 'DomainUpdateAuthinfo Error: ' . $domainUpdateAuthinfo['error'] . PHP_EOL; 27 | } 28 | else 29 | { 30 | echo "DomainUpdateAuthinfo result: " . $domainUpdateAuthinfo['code'] . ": " . $domainUpdateAuthinfo['msg'] . PHP_EOL; 31 | } 32 | 33 | $logout = $epp->logout(); 34 | 35 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 36 | } catch(\Pinga\Tembo\Exception\EppException $e) { 37 | echo "Error : ".$e->getMessage() . PHP_EOL; 38 | } catch(Throwable $e) { 39 | echo "Error : ".$e->getMessage() . PHP_EOL; 40 | } -------------------------------------------------------------------------------- /examples/DomainUpdateContact.php: -------------------------------------------------------------------------------- 1 | 'test.example', 20 | 'contacttype' => 'admin', 21 | 'old_contactid' => 'ABC123', 22 | 'new_contactid' => 'ABC456' 23 | ); 24 | $domainUpdateContact = $epp->domainUpdateContact($params); 25 | 26 | if (array_key_exists('error', $domainUpdateContact)) 27 | { 28 | echo 'DomainUpdateContact Error: ' . $domainUpdateContact['error'] . PHP_EOL; 29 | } 30 | else 31 | { 32 | echo "DomainUpdateContact result: " . $domainUpdateContact['code'] . ": " . $domainUpdateContact['msg'] . PHP_EOL; 33 | } 34 | 35 | $logout = $epp->logout(); 36 | 37 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 38 | } catch(\Pinga\Tembo\Exception\EppException $e) { 39 | echo "Error : ".$e->getMessage() . PHP_EOL; 40 | } catch(Throwable $e) { 41 | echo "Error : ".$e->getMessage() . PHP_EOL; 42 | } -------------------------------------------------------------------------------- /examples/DomainUpdateDNSSEC.php: -------------------------------------------------------------------------------- 1 | 'test.example', 20 | //rem or //addrem 21 | 'command' => 'add', 22 | 'keyTag_1' => '33409', 23 | 'alg_1' => '8', 24 | 'digestType_1' => '1', 25 | 'digest_1' => 'F4D6E26B3483C3D7B3EE17799B0570497FAF33BCB12B9B9CE573DDB491E16948' 26 | ); 27 | $domainUpdateDNSSEC = $epp->domainUpdateDNSSEC($params); 28 | 29 | if (array_key_exists('error', $domainUpdateDNSSEC)) 30 | { 31 | echo 'DomainUpdateDNSSEC Error: ' . $domainUpdateDNSSEC['error'] . PHP_EOL; 32 | } 33 | else 34 | { 35 | echo "DomainUpdateDNSSEC result: " . $domainUpdateDNSSEC['code'] . ": " . $domainUpdateDNSSEC['msg'] . PHP_EOL; 36 | } 37 | 38 | $logout = $epp->logout(); 39 | 40 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 41 | } catch(\Pinga\Tembo\Exception\EppException $e) { 42 | echo "Error : ".$e->getMessage() . PHP_EOL; 43 | } catch(Throwable $e) { 44 | echo "Error : ".$e->getMessage() . PHP_EOL; 45 | } -------------------------------------------------------------------------------- /examples/DomainUpdateNS.php: -------------------------------------------------------------------------------- 1 | 'test.example', 20 | // Comment these lines and uncomment the block below if the TLD requires with IP addresses: 21 | 'ns1' => 'ns1.example.com', 22 | 'ns2' => 'ns2.example.com', 23 | /* Uncomment the following block for TLDs requiring with IP addresses: 24 | 'nss' => array( 25 | array( 26 | 'hostName' => 'ns1.example.com', 27 | 'ipv4' => '192.168.1.1', 28 | 'ipv6' => '2001:db8::1' 29 | ), 30 | array( 31 | 'hostName' => 'ns2.example.com', 32 | 'ipv4' => '192.168.1.2' 33 | ), 34 | array( 35 | 'hostName' => 'ns3.example.com' 36 | ) 37 | ), */ 38 | ); 39 | $domainUpdateNS = $epp->domainUpdateNS($params); 40 | 41 | if (array_key_exists('error', $domainUpdateNS)) 42 | { 43 | echo 'DomainUpdateNS Error: ' . $domainUpdateNS['error'] . PHP_EOL; 44 | } 45 | else 46 | { 47 | echo "DomainUpdateNS result: " . $domainUpdateNS['code'] . ": " . $domainUpdateNS['msg'] . PHP_EOL; 48 | } 49 | 50 | $logout = $epp->logout(); 51 | 52 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 53 | } catch(\Pinga\Tembo\Exception\EppException $e) { 54 | echo "Error : ".$e->getMessage() . PHP_EOL; 55 | } catch(Throwable $e) { 56 | echo "Error : ".$e->getMessage() . PHP_EOL; 57 | } -------------------------------------------------------------------------------- /examples/DomainUpdateStatus.php: -------------------------------------------------------------------------------- 1 | 'test.example', 20 | 'command' => 'add', 21 | 'status' => 'clientTransferProhibited' 22 | ); 23 | $domainUpdateStatus = $epp->domainUpdateStatus($params); 24 | 25 | if (array_key_exists('error', $domainUpdateStatus)) 26 | { 27 | echo 'DomainUpdateStatus Error: ' . $domainUpdateStatus['error'] . PHP_EOL; 28 | } 29 | else 30 | { 31 | echo "DomainUpdateStatus result: " . $domainUpdateStatus['code'] . ": " . $domainUpdateStatus['msg'] . PHP_EOL; 32 | } 33 | 34 | $logout = $epp->logout(); 35 | 36 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 37 | } catch(\Pinga\Tembo\Exception\EppException $e) { 38 | echo "Error : ".$e->getMessage() . PHP_EOL; 39 | } catch(Throwable $e) { 40 | echo "Error : ".$e->getMessage() . PHP_EOL; 41 | } -------------------------------------------------------------------------------- /examples/Hello.php: -------------------------------------------------------------------------------- 1 | hello(); 19 | echo 'Hello Result: ' . PHP_EOL . $hello . PHP_EOL; 20 | 21 | $logout = $epp->logout(); 22 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 23 | } catch(\Pinga\Tembo\Exception\EppException $e) { 24 | echo "Error : ".$e->getMessage() . PHP_EOL; 25 | } catch(Throwable $e) { 26 | echo "Error : ".$e->getMessage() . PHP_EOL; 27 | } -------------------------------------------------------------------------------- /examples/HostCheck.php: -------------------------------------------------------------------------------- 1 | 'ns1.test.example' 20 | ); 21 | $hostCheck = $epp->hostCheck($params); 22 | 23 | if (array_key_exists('error', $hostCheck)) 24 | { 25 | echo 'HostCheck Error: ' . $hostCheck['error'] . PHP_EOL; 26 | } 27 | else 28 | { 29 | if ($registry == 'fred') { 30 | echo "HostCheck result: " . $hostCheck['code'] . ": " . $hostCheck['msg'] . PHP_EOL; 31 | $x=1; 32 | foreach ($hostCheck['hosts'] as $host) 33 | { 34 | if ($host['avail']) 35 | { 36 | echo "Host ".$x.": " . $host['id'] . " is available" . PHP_EOL; 37 | } 38 | else 39 | { 40 | echo "Host ".$x.": " . $host['id'] . " is not available because: " . $host['reason'] . PHP_EOL; 41 | } 42 | $x++; 43 | } 44 | } else { 45 | echo "HostCheck result: " . $hostCheck['code'] . ": " . $hostCheck['msg'] . PHP_EOL; 46 | $x=1; 47 | foreach ($hostCheck['hosts'] as $host) 48 | { 49 | if ($host['avail'] == 1) 50 | { 51 | echo "Host ".$x.": " . $host['name'] . " is available" . PHP_EOL; 52 | } 53 | else 54 | { 55 | echo "Host ".$x.": " . $host['name'] . " is not available because: " . $host['reason'] . PHP_EOL; 56 | } 57 | $x++; 58 | } 59 | } 60 | } 61 | 62 | $logout = $epp->logout(); 63 | 64 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 65 | } catch(\Pinga\Tembo\Exception\EppException $e) { 66 | echo "Error : ".$e->getMessage() . PHP_EOL; 67 | } catch(Throwable $e) { 68 | echo "Error : ".$e->getMessage() . PHP_EOL; 69 | } -------------------------------------------------------------------------------- /examples/HostCreate.php: -------------------------------------------------------------------------------- 1 | 'ns1.test.example', 20 | 'ipaddress' => '8.8.8.8' 21 | ); 22 | $hostCreate = $epp->hostCreate($params); 23 | 24 | if (array_key_exists('error', $hostCreate)) 25 | { 26 | echo 'HostCreate Error: ' . $hostCreate['error'] . PHP_EOL; 27 | } 28 | else 29 | { 30 | echo 'HostCreate Result: ' . $hostCreate['code'] . ': ' . $hostCreate['msg'] . PHP_EOL . 'New Host: ' . $hostCreate['name'] . PHP_EOL; 31 | } 32 | 33 | $logout = $epp->logout(); 34 | 35 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 36 | } catch(\Pinga\Tembo\Exception\EppException $e) { 37 | echo "Error : ".$e->getMessage() . PHP_EOL; 38 | } catch(Throwable $e) { 39 | echo "Error : ".$e->getMessage() . PHP_EOL; 40 | } -------------------------------------------------------------------------------- /examples/HostDelete.php: -------------------------------------------------------------------------------- 1 | 'ns1.test.example' 20 | ); 21 | $hostDelete = $epp->hostDelete($params); 22 | 23 | if (array_key_exists('error', $hostDelete)) 24 | { 25 | echo 'HostDelete Error: ' . $hostDelete['error'] . PHP_EOL; 26 | } 27 | else 28 | { 29 | echo "HostDelete result: " . $hostDelete['code'] . ": " . $hostDelete['msg'] . PHP_EOL; 30 | } 31 | 32 | $logout = $epp->logout(); 33 | 34 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 35 | } catch(\Pinga\Tembo\Exception\EppException $e) { 36 | echo "Error : ".$e->getMessage() . PHP_EOL; 37 | } catch(Throwable $e) { 38 | echo "Error : ".$e->getMessage() . PHP_EOL; 39 | } -------------------------------------------------------------------------------- /examples/HostInfo.php: -------------------------------------------------------------------------------- 1 | 'ns1.test.example' 20 | ); 21 | $hostInfo = $epp->hostInfo($params); 22 | 23 | if (array_key_exists('error', $hostInfo)) 24 | { 25 | echo 'HostInfo Error: ' . $hostInfo['error'] . PHP_EOL; 26 | } 27 | else 28 | { 29 | if ($registry == 'fred') { 30 | echo 'HostInfo Result: ' . $hostInfo['code'] . ': ' . $hostInfo['msg'] . PHP_EOL; 31 | echo 'Name: ' . $hostInfo['name'] . PHP_EOL; 32 | echo 'Status '; 33 | foreach ($hostInfo['status'] as $key => $value) { 34 | echo $key . ': ' . $value . ', '; 35 | } 36 | echo PHP_EOL; 37 | echo 'Addr '; 38 | foreach ($hostInfo['addr'] as $key => $value) { 39 | echo $key . ': ' . $value . ', '; 40 | } 41 | echo PHP_EOL; 42 | echo 'Current Registrar: ' . $hostInfo['clID'] . PHP_EOL; 43 | echo 'Original Registrar: ' . $hostInfo['crID'] . PHP_EOL; 44 | echo 'Created On: ' . $hostInfo['crDate'] . PHP_EOL; 45 | echo 'Updated By: ' . $hostInfo['upID'] . PHP_EOL; 46 | echo 'Updated On: ' . $hostInfo['upDate'] . PHP_EOL; 47 | } else { 48 | echo 'HostInfo Result: ' . $hostInfo['code'] . ': ' . $hostInfo['msg'] . PHP_EOL; 49 | echo 'Name: ' . $hostInfo['name'] . PHP_EOL; 50 | echo 'Status: ' . $hostInfo['status'][0] . PHP_EOL; 51 | echo 'Addr: ' . $hostInfo['addr'][0] . PHP_EOL; 52 | echo 'Current Registrar: ' . $hostInfo['clID'] . PHP_EOL; 53 | echo 'Original Registrar: ' . $hostInfo['crID'] . PHP_EOL; 54 | echo 'Created On: ' . $hostInfo['crDate'] . PHP_EOL; 55 | echo 'Updated By: ' . $hostInfo['upID'] . PHP_EOL; 56 | echo 'Updated On: ' . $hostInfo['upDate'] . PHP_EOL; 57 | } 58 | } 59 | 60 | $logout = $epp->logout(); 61 | 62 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 63 | } catch(\Pinga\Tembo\Exception\EppException $e) { 64 | echo "Error : ".$e->getMessage() . PHP_EOL; 65 | } catch(Throwable $e) { 66 | echo "Error : ".$e->getMessage() . PHP_EOL; 67 | } -------------------------------------------------------------------------------- /examples/HostUpdate.php: -------------------------------------------------------------------------------- 1 | 'ns1.test.example', 20 | 'currentipaddress' => '4.4.4.4', 21 | 'newipaddress' => '8.8.8.8' 22 | ); 23 | $hostUpdate = $epp->hostUpdate($params); 24 | 25 | if (array_key_exists('error', $hostUpdate)) 26 | { 27 | echo 'HostUpdate Error: ' . $hostUpdate['error'] . PHP_EOL; 28 | } 29 | else 30 | { 31 | echo 'HostUpdate Result: ' . $hostUpdate['code'] . ': ' . $hostUpdate['msg'] . PHP_EOL; 32 | } 33 | 34 | $logout = $epp->logout(); 35 | 36 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 37 | } catch(\Pinga\Tembo\Exception\EppException $e) { 38 | echo "Error : ".$e->getMessage() . PHP_EOL; 39 | } catch(Throwable $e) { 40 | echo "Error : ".$e->getMessage() . PHP_EOL; 41 | } -------------------------------------------------------------------------------- /examples/KeepAlive.php: -------------------------------------------------------------------------------- 1 | hello(); 23 | echo 'Keep-alive Result: ' . PHP_EOL . $hello . PHP_EOL; 24 | sleep(600); // wait for 10 minutes 25 | } 26 | 27 | $logout = $epp->logout(); 28 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 29 | } catch(\Pinga\Tembo\Exception\EppException $e) { 30 | echo "Error : ".$e->getMessage() . PHP_EOL; 31 | } catch(Throwable $e) { 32 | echo "Error : ".$e->getMessage() . PHP_EOL; 33 | } -------------------------------------------------------------------------------- /examples/PollAck.php: -------------------------------------------------------------------------------- 1 | '12345' 20 | ); 21 | $pollAck = $epp->pollAck($params); 22 | 23 | if (isset($pollAck['error'])) { 24 | echo 'Error: ' . $pollAck['error'] . PHP_EOL; 25 | } else { 26 | echo 'Poll Ack Result: ' . $pollAck['code'] . ': ' . $pollAck['msg'] . PHP_EOL; 27 | } 28 | 29 | $logout = $epp->logout(); 30 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 31 | } catch(\Pinga\Tembo\Exception\EppException $e) { 32 | echo "Error : ".$e->getMessage() . PHP_EOL; 33 | } catch(Throwable $e) { 34 | echo "Error : ".$e->getMessage() . PHP_EOL; 35 | } -------------------------------------------------------------------------------- /examples/PollReq.php: -------------------------------------------------------------------------------- 1 | pollReq(); 19 | if ($pollReq['messages'] == 0) { 20 | echo 'No messages in poll queue' . PHP_EOL; 21 | } else { 22 | echo 'Messages in Poll: ' . $pollReq['messages'] . PHP_EOL; 23 | echo 'Last message ID: ' . $pollReq['last_id'] . PHP_EOL; 24 | echo 'Last message date: ' . $pollReq['qDate'] . PHP_EOL; 25 | echo 'Last message content: ' . $pollReq['last_msg'] . PHP_EOL; 26 | } 27 | 28 | $logout = $epp->logout(); 29 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 30 | } catch(\Pinga\Tembo\Exception\EppException $e) { 31 | echo "Error : ".$e->getMessage() . PHP_EOL; 32 | } catch(Throwable $e) { 33 | echo "Error : ".$e->getMessage() . PHP_EOL; 34 | } -------------------------------------------------------------------------------- /examples/RRIConnection.php: -------------------------------------------------------------------------------- 1 | 'rri.denic.de', 20 | 'port' => 1234, 21 | 'timeout' => 30 22 | ); 23 | $user = 'your_username'; 24 | $password = 'your_password'; 25 | 26 | $conn = $epp->connect($info); 27 | 28 | // Login 29 | $login = $epp->RRI_SendAndRead($conn, "version: 4.0\naction: LOGIN\nuser: $user\npassword: $password\n"); 30 | echo 'Login: ' . PHP_EOL . $login . PHP_EOL; 31 | 32 | // Contact Create 33 | $contact = "Action: Create\n"; 34 | $contact .= "Version: 4.0\n"; 35 | $contact .= "Ctid: " . uniqid() . "\n"; 36 | $contact .= "Handle: DENIC-1000002-" . uniqid() . "\n"; 37 | $contact .= "Type: person\n"; 38 | $contact .= "Name: Petko Petkov\n"; 39 | $contact .= "Organisation: Petkovi OOD\n"; 40 | $contact .= "Address: bul. Vitosha 1\n"; 41 | $contact .= "PostalCode: 1000\n"; 42 | $contact .= "City: Sofia\n"; 43 | $contact .= "CountryCode: BG\n"; 44 | $contact .= "Email: test@petkovi.bg\n"; 45 | //$con_create = $epp->RRI_SendAndRead($conn, $contact); 46 | //echo 'Contact Create: ' . PHP_EOL . $con_create . PHP_EOL; 47 | 48 | // Contact Check 49 | $handle = 'DENIC-1000002-MAX'; 50 | //$con_check = $epp->RRI_SendAndRead($conn, "version: 4.0\naction: check\nhandle: $handle\n"); 51 | //echo 'Contact Check: ' . PHP_EOL . $con_check . PHP_EOL; 52 | 53 | // Contact Info 54 | $handle = 'DENIC-1000002-MAX'; 55 | //$con_info = $epp->RRI_SendAndRead($conn, "version: 4.0\naction: info\nhandle: $handle\n"); 56 | //echo 'Contact Info: ' . PHP_EOL . $con_info . PHP_EOL; 57 | 58 | // Domain Create 59 | $domain = "Action: Create\n"; 60 | $domain .= "Version: 4.0\n"; 61 | $domain .= "Domain: de-example.de\n"; 62 | $domain .= "Holder: DENIC-1000002-HOLDER\n"; 63 | $domain .= "Abusecontact: DENIC-1000002-ABUSE\n"; 64 | $domain .= "Generalrequest: DENIC-1000002-GENERAL\n"; 65 | $domain .= "Nserver: ns1.beispiel-eins.de\n"; 66 | $domain .= "Nserver: ns2.beispiel-eins.de\n"; 67 | //$dom_create = $epp->RRI_SendAndRead($conn, $domain); 68 | //echo 'Domain Create: ' . PHP_EOL . $dom_create . PHP_EOL; 69 | 70 | // Domain Check 71 | $domain = 'de-example.de'; 72 | //$dom_check = $epp->RRI_SendAndRead($conn, "version: 4.0\naction: check\nDomain: $domain\n"); 73 | //echo 'Domain Check: ' . PHP_EOL . $dom_check . PHP_EOL; 74 | 75 | // Domain Info 76 | $domain = 'domain-check.de'; 77 | $authinfo = 'abc123'; 78 | //$dom_info = $epp->RRI_SendAndRead($conn, "version: 4.0\naction: info\nrecursive: true\nAuthInfo: $authinfo\ndomain: $domain\n"); 79 | //echo 'Domain Info: ' . PHP_EOL . $dom_info . PHP_EOL; 80 | 81 | // Domain Update 82 | $domain = "Action: update\n"; 83 | $domain .= "Version: 4.0\n"; 84 | $domain .= "Ctid: " . uniqid() . "\n"; 85 | $domain .= "Domain: de-example.de\n"; 86 | $domain .= "Holder: DENIC-1000002-HOLDER\n"; 87 | $domain .= "Abusecontact: DENIC-1000002-ABUSE\n"; 88 | $domain .= "Generalrequest: DENIC-1000002-GENERAL\n"; 89 | $domain .= "Nserver: ns1.beispiel-eins.de\n"; 90 | $domain .= "Nserver: ns2.beispiel-eins.de 81.91.170.12\n"; 91 | $domain .= "Nserver: ns2.beispiel-eins.de 2001:608:6:6:0:0:0:11\n"; 92 | //$dom_update = $epp->RRI_SendAndRead($conn, $domain); 93 | //echo 'Domain Update: ' . PHP_EOL . $dom_update . PHP_EOL; 94 | 95 | // Domain Delete 96 | $domain = "Action: delete\n"; 97 | $domain .= "Version: 4.0\n"; 98 | $domain .= "Ctid: " . uniqid() . "\n"; 99 | $domain .= "Domain: de-example.de\n"; 100 | $domain .= "Holder: DENIC-1000002-HOLDER\n"; 101 | //$dom_delete = $epp->RRI_SendAndRead($conn, $domain); 102 | //echo 'Domain Delete: ' . PHP_EOL . $dom_delete . PHP_EOL; 103 | 104 | // Domain Restore 105 | $domain = "Action: restore\n"; 106 | $domain .= "Version: 4.0\n"; 107 | $domain .= "Ctid: " . uniqid() . "\n"; 108 | $domain .= "Domain: de-example.de\n"; 109 | //$dom_restore = $epp->RRI_SendAndRead($conn, $domain); 110 | //echo 'Domain Restore: ' . PHP_EOL . $dom_restore . PHP_EOL; 111 | 112 | // Create AuthInfo1 113 | $domain = "Action: CREATE-AUTHINFO1\n"; 114 | $domain .= "Version: 4.0\n"; 115 | $domain .= "Ctid: " . uniqid() . "\n"; 116 | $domain .= "Domain: de-example.de\n"; 117 | $domain .= "AuthInfoHash: 4213d924230224fd719218b4acbd92f96ebe4344f3d5d1478dede1aa44e4cf4b\n"; 118 | $domain .= "AuthInfoExpire: 20100724\n"; 119 | //$dom_authinfo1 = $epp->RRI_SendAndRead($conn, $domain); 120 | //echo 'Domain AuthInfo1: ' . PHP_EOL . $dom_authinfo1 . PHP_EOL; 121 | 122 | // Create AuthInfo2 123 | $domain = "Action: CREATE-AUTHINFO2\n"; 124 | $domain .= "Version: 4.0\n"; 125 | $domain .= "Ctid: " . uniqid() . "\n"; 126 | $domain .= "Domain: de-example.de\n"; 127 | //$dom_authinfo2 = $epp->RRI_SendAndRead($conn, $domain); 128 | //echo 'Domain AuthInfo2: ' . PHP_EOL . $dom_authinfo2 . PHP_EOL; 129 | 130 | // Delete AuthInfo1 131 | $domain = "Action: DELETE-AUTHINFO1\n"; 132 | $domain .= "Version: 4.0\n"; 133 | $domain .= "Ctid: " . uniqid() . "\n"; 134 | $domain .= "Domain: de-example.de\n"; 135 | //$dom_authinfo1 = $epp->RRI_SendAndRead($conn, $domain); 136 | //echo 'Delete AuthInfo1: ' . PHP_EOL . $dom_authinfo1 . PHP_EOL; 137 | 138 | // Domain Chprov 139 | $domain = "Action: CHPROV\n"; 140 | $domain .= "Version: 4.0\n"; 141 | $domain .= "Ctid: " . uniqid() . "\n"; 142 | $domain .= "Domain: de-example.de\n"; 143 | $domain .= "Holder: DENIC-1000002-HOLDER\n"; 144 | $domain .= "Abusecontact: DENIC-1000002-ABUSE\n"; 145 | $domain .= "Generalrequest: DENIC-1000002-GENERAL\n"; 146 | $domain .= "Nserver: ns1.beispiel-eins.de\n"; 147 | $domain .= "Nserver: ns2.beispiel-eins.de\n"; 148 | $domain .= "AuthInfo: SupermanistSuper\n"; 149 | //$dom_chprov = $epp->RRI_SendAndRead($conn, $domain); 150 | //echo 'Domain Chprov: ' . PHP_EOL . $dom_chprov . PHP_EOL; 151 | 152 | // Domain Transit 153 | $domain = "Action: TRANSIT\n"; 154 | $domain .= "Version: 4.0\n"; 155 | $domain .= "Ctid: " . uniqid() . "\n"; 156 | $domain .= "Domain: de-example.de\n"; 157 | //choose one of the following 2 158 | $domain .= "Disconnect: true\n"; 159 | $domain .= "Disconnect: false\n"; 160 | //$dom_transit = $epp->RRI_SendAndRead($conn, $domain); 161 | //echo 'Domain Transit: ' . PHP_EOL . $dom_transit . PHP_EOL; 162 | 163 | // Queue Read 164 | // MsgType can be one of: chprovAuthInfo, authInfoExpire, authInfo2Notify, authInfo2Delete, expireWarning, expire, domainDelete 165 | $queue = "Action: QUEUE-READ\n"; 166 | $queue .= "Version: 4.0\n"; 167 | //$queue .= "MsgType: (!choose!)\n"; 168 | //$queue_read = $epp->RRI_SendAndRead($conn, $queue); 169 | //echo 'Queue Read: ' . PHP_EOL . $queue_read . PHP_EOL; 170 | 171 | // Queue Delete 172 | // MsgType can be one of: chprovAuthInfo, authInfoExpire, authInfo2Notify, authInfo2Delete, expireWarning, expire, domainDelete 173 | $queue = "Action: QUEUE-DELETE\n"; 174 | $queue .= "Version: 4.0\n"; 175 | $queue .= "Msgid: (!message_id!)\n"; 176 | //$queue .= "MsgType: (!choose!)\n"; 177 | $queue .= "Ctid: " . uniqid() . "\n"; 178 | //$queue_delete = $epp->RRI_SendAndRead($conn, $queue); 179 | //echo 'Queue Delete: ' . PHP_EOL . $queue_delete . PHP_EOL; 180 | 181 | // Registrar Info 182 | $registrar = 'DENIC-99995'; 183 | //$reg_info = $epp->RRI_SendAndRead($conn, "version: 4.0\naction: info\nRegacc: $registrar\n"); 184 | //echo 'Registrar Info: ' . PHP_EOL . $reg_info . PHP_EOL; 185 | 186 | // Logout 187 | $logout = $epp->RRI_SendAndRead($conn, "version: 4.0\naction: LOGOUT\n"); 188 | echo 'Logout: ' . PHP_EOL . $logout . PHP_EOL; 189 | 190 | } catch(\Pinga\Tembo\Exception\EppException $e) { 191 | echo "Error : ".$e->getMessage() . PHP_EOL; 192 | } catch(Throwable $e) { 193 | echo "Error : ".$e->getMessage() . PHP_EOL; 194 | } 195 | -------------------------------------------------------------------------------- /examples/RawXml.php: -------------------------------------------------------------------------------- 1 | ' 21 | 24 | 25 | 26 | 27 | example.com 28 | example.net 29 | 30 | 31 | '.$clTRID.' 32 | 33 | 34 | '); 35 | $rawXml = $epp->rawXml($params); 36 | 37 | if (array_key_exists('error', $rawXml)) 38 | { 39 | echo 'RawXml Error: ' . $rawXml['error'] . PHP_EOL; 40 | } 41 | else 42 | { 43 | echo 'RawXml Result: ' . $rawXml['code'] . ': ' . $rawXml['msg'] . PHP_EOL; 44 | echo 'Command Result: ' . $rawXml['xml'] . PHP_EOL; 45 | } 46 | 47 | $logout = $epp->logout(); 48 | 49 | echo 'Logout Result: ' . $logout['code'] . ': ' . $logout['msg'][0] . PHP_EOL; 50 | } catch(\Pinga\Tembo\Exception\EppException $e) { 51 | echo "Error : ".$e->getMessage() . PHP_EOL; 52 | } catch(Throwable $e) { 53 | echo "Error : ".$e->getMessage() . PHP_EOL; 54 | } -------------------------------------------------------------------------------- /examples/TMCHCron.php: -------------------------------------------------------------------------------- 1 | [ 12 | 'username' => '', 13 | 'password' => '', 14 | 'url' => 'https://test.ry.marksdb.org/smdrl/smdrl-latest.csv', 15 | 'save_to' => 'smdrl-latest.csv' 16 | ], 17 | 'surl' => [ 18 | 'username' => '', 19 | 'password' => '', 20 | 'url' => 'https://test.ry.marksdb.org/dnl/surl-latest.csv', 21 | 'save_to' => 'surl-latest.csv' 22 | ], 23 | 'dnl' => [ 24 | 'username' => '', 25 | 'password' => '', 26 | 'url' => 'https://test.ry.marksdb.org/dnl/dnl-latest.csv', 27 | 'save_to' => 'dnl-latest.csv' 28 | ], 29 | 'clr' => [ 30 | 'username' => '', 31 | 'password' => '', 32 | 'url' => 'http://crl.icann.org/tmch.crl', 33 | 'save_to' => 'tmch.crl' 34 | ] 35 | ]; 36 | 37 | foreach ($settings as $key => $value) { 38 | $username = $value['username']; 39 | $password = $value['password']; 40 | $fp = fopen($value['save_to'], 'w'); 41 | 42 | if (!$fp) { 43 | throw new Exception('Could not open: ' . $value['save_to']); 44 | } 45 | 46 | $ch = curl_init($value['url']); 47 | 48 | if ($username && $password) { 49 | curl_setopt($ch, CURLOPT_USERPWD, "$username:$password"); 50 | } 51 | 52 | curl_setopt_array($ch, [ 53 | CURLOPT_FILE => $fp, 54 | CURLOPT_TIMEOUT => 60, 55 | CURLOPT_ENCODING => 'gzip', 56 | CURLOPT_FOLLOWLOCATION => true 57 | ]); 58 | 59 | curl_exec($ch); 60 | 61 | if (curl_errno($ch)) { 62 | throw new Exception(curl_error($ch)); 63 | } 64 | 65 | $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); 66 | 67 | curl_close($ch); 68 | fclose($fp); 69 | 70 | $date = date('Y-m-j H:i:s'); 71 | 72 | if ($statusCode === 200) { 73 | echo "{$date} | {$key} | Success!\n"; 74 | } else { 75 | echo "{$date} | {$key} | Failed with code: {$statusCode}\n"; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /examples/TMCHExample.php: -------------------------------------------------------------------------------- 1 | registerXPathNamespace("tmNotice", "urn:ietf:params:xml:ns:tmNotice-1.0"); 48 | $claims = $xml_object->xpath('//tmNotice:claim'); 49 | 50 | $note = "This message is a notification that you have applied for a domain name that matches a trademark record submitted to the Trademark Clearinghouse. Your eligibility to register this domain name will depend on your intended use and if it is similar or relates to the trademarks listed below.".PHP_EOL; 51 | 52 | $note .= "Please be aware that your rights to register this domain name may not be protected as a noncommercial use or 'fair use' in accordance with the laws of your country. It is crucial that you read and understand the trademark information provided, including the trademarks, jurisdictions, and goods and services for which the trademarks are registered.".PHP_EOL; 53 | 54 | $note .= "It's also important to note that not all jurisdictions review trademark applications closely, so some of the trademark information may exist in a national or regional registry that does not conduct a thorough review of trademark rights prior to registration. If you have any questions, it's recommended that you consult with a legal expert or attorney on trademarks and intellectual property for guidance.".PHP_EOL; 55 | 56 | $note .= "By continuing with this registration, you're representing that you have received this notice and understand it and, to the best of your knowledge, your registration and use of the requested domain name will not infringe on the trademark rights listed below.".PHP_EOL; 57 | 58 | $note .= "The following ".count($claims)." marks are listed in the Trademark Clearinghouse:".PHP_EOL; 59 | 60 | $markName = $xml_object->xpath('//tmNotice:markName'); 61 | $jurDesc = $xml_object->xpath('//tmNotice:jurDesc'); 62 | $class_desc = $xml_object->xpath('//tmNotice:classDesc'); 63 | 64 | $note .= PHP_EOL; 65 | 66 | $claims = $xml_object->xpath('//tmNotice:claim'); 67 | foreach ($claims as $claim) { 68 | $elements = $claim->xpath('.//*'); 69 | $first_element_a = true; 70 | $first_element_b = true; 71 | foreach ($elements as $element) { 72 | $element_name = trim($element->getName()); 73 | $element_text = trim((string)$element); 74 | if (!empty($element_name) && !empty($element_text)) { 75 | if ($element->xpath('..')[0]->getName() == "holder" && $first_element_a) { 76 | $note .= "Trademark Registrant: ". PHP_EOL; 77 | $first_element_a = false; 78 | } 79 | if ($element->xpath('..')[0]->getName() == "contact" && $first_element_b) { 80 | $note .= "Trademark Contact: ". PHP_EOL; 81 | $first_element_b = false; 82 | } 83 | $note .= $element_name . ": " . $element_text . PHP_EOL; 84 | } 85 | } 86 | $note .= PHP_EOL; 87 | } 88 | 89 | echo $note; 90 | -------------------------------------------------------------------------------- /log/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in this directory 2 | * 3 | # Except this file 4 | !.gitignore 5 | -------------------------------------------------------------------------------- /src/EppRegistryFactory.php: -------------------------------------------------------------------------------- 1 | resource = stream_socket_client("ssl://{$host}:{$port}", $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT); 29 | 30 | if (!$this->resource) { 31 | throw new EppException("Cannot connect to server '{$host}': {$errmsg}"); 32 | } 33 | 34 | return $this->resource; 35 | } 36 | 37 | /** 38 | * RRI_SendAndRead 39 | */ 40 | public function RRI_SendAndRead($conn, $order) 41 | { 42 | $len = strlen($order); 43 | $nlen = pack("N", $len); // Convert Bytes of len to Network-Byte-Order 44 | $bytes_send = fwrite($conn, $nlen . $order, $len + 4); // send length of order and order 45 | if ($bytes_send === false) { 46 | return false; 47 | } 48 | $nlen = fread($conn, 4); // read 4-Byte length of answer 49 | $bytes = unpack("N", $nlen); // convert bytes to local order 50 | $rest = $bytes[1]; 51 | $answer = ""; 52 | while ($rest) { 53 | $a = fread($conn, $rest); // read answer 54 | $answer .= $a; 55 | $gelesen = strlen($a); 56 | $rest -= $gelesen; 57 | if (feof($conn)) { 58 | break; 59 | } 60 | } 61 | return $answer; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/Registries/FrEpp.php: -------------------------------------------------------------------------------- 1 | startElement('svcExtension'); 26 | $xml->writeElement('extURI', 'urn:ietf:params:xml:ns:rgp-1.0'); 27 | $xml->writeElement('extURI', 'http://www.afnic.fr/xml/epp/frnic-2.0'); 28 | $xml->writeElement('extURI', 'urn:ietf:params:xml:ns:secDNS-1.1'); 29 | $xml->writeElement('extURI', 'urn:ietf:params:xml:ns:launch-1.0'); 30 | $xml->endElement(); // svcExtension 31 | } 32 | 33 | /** 34 | * contactCreate 35 | */ 36 | public function contactCreate($params = array()) 37 | { 38 | if (!$this->isLoggedIn) { 39 | return array( 40 | 'code' => 2002, 41 | 'msg' => 'Command use error' 42 | ); 43 | } 44 | 45 | $return = array(); 46 | try { 47 | $from = $to = array(); 48 | $from[] = '/{{ type }}/'; 49 | $to[] = htmlspecialchars($params['type']); 50 | $from[] = '/{{ id }}/'; 51 | $to[] = htmlspecialchars($params['id']); 52 | $from[] = '/{{ firstname }}/'; 53 | $to[] = htmlspecialchars($params['firstname']); 54 | $from[] = '/{{ lastname }}/'; 55 | $to[] = htmlspecialchars($params['lastname']); 56 | $from[] = '/{{ org }}/'; 57 | $to[] = htmlspecialchars($params['companyname']); 58 | $from[] = '/{{ street1 }}/'; 59 | $to[] = htmlspecialchars($params['address1']); 60 | $from[] = '/{{ street2 }}/'; 61 | $to[] = htmlspecialchars($params['address2']); 62 | $from[] = '/{{ street3 }}/'; 63 | $street3 = (isset($params['address3']) ? $params['address3'] : ''); 64 | $to[] = htmlspecialchars($street3); 65 | $from[] = '/{{ city }}/'; 66 | $to[] = htmlspecialchars($params['city']); 67 | $from[] = '/{{ state }}/'; 68 | $to[] = htmlspecialchars($params['state']); 69 | $from[] = '/{{ postcode }}/'; 70 | $to[] = htmlspecialchars($params['postcode']); 71 | $from[] = '/{{ country }}/'; 72 | $to[] = htmlspecialchars($params['country']); 73 | $from[] = '/{{ phonenumber }}/'; 74 | $to[] = htmlspecialchars($params['fullphonenumber']); 75 | $from[] = '/{{ email }}/'; 76 | $to[] = htmlspecialchars($params['email']); 77 | $from[] = '/{{ authInfo }}/'; 78 | $to[] = htmlspecialchars($params['authInfoPw']); 79 | $from[] = '/{{ clTRID }}/'; 80 | $microtime = str_replace('.', '', round(microtime(1), 3)); 81 | $to[] = htmlspecialchars($this->prefix . '-contact-create-' . $microtime); 82 | $from[] = "/<\w+:\w+>\s*<\/\w+:\w+>\s+/ims"; 83 | $to[] = ''; 84 | $xml = preg_replace($from, $to, ' 85 | 88 | 89 | 90 | 92 | {{ id }} 93 | 94 | {{ lastname }} 95 | {{ org }} 96 | 97 | {{ street1 }} 98 | {{ street2 }} 99 | {{ street3 }} 100 | {{ city }} 101 | {{ state }} 102 | {{ postcode }} 103 | {{ country }} 104 | 105 | 106 | {{ phonenumber }} 107 | 108 | {{ email }} 109 | 110 | {{ authInfo }} 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | {{ firstname }} 119 | 120 | 121 | 122 | 123 | {{ clTRID }} 124 | 125 | '); 126 | $r = $this->writeRequest($xml); 127 | $code = (int)$r->response->result->attributes()->code; 128 | $msg = (string)$r->response->result->msg; 129 | $r = $r->response->resData->children('urn:ietf:params:xml:ns:contact-1.0')->creData; 130 | $id = (string)$r->id; 131 | 132 | $return = array( 133 | 'code' => $code, 134 | 'msg' => $msg, 135 | 'id' => $id 136 | ); 137 | } catch (\Exception $e) { 138 | $return = array( 139 | 'error' => $e->getMessage() 140 | ); 141 | } 142 | 143 | return $return; 144 | } 145 | 146 | /** 147 | * domainCheckClaims 148 | */ 149 | public function domainCheckClaims($params = array()) 150 | { 151 | if (!$this->isLoggedIn) { 152 | return array( 153 | 'code' => 2002, 154 | 'msg' => 'Command use error' 155 | ); 156 | } 157 | 158 | throw new EppException("Launch extension not supported!"); 159 | } 160 | 161 | /** 162 | * domainTransfer 163 | */ 164 | public function domainTransfer($params = array()) 165 | { 166 | if (!$this->isLoggedIn) { 167 | return array( 168 | 'code' => 2002, 169 | 'msg' => 'Command use error' 170 | ); 171 | } 172 | 173 | $return = array(); 174 | try { 175 | $from = $to = array(); 176 | $from[] = '/{{ name }}/'; 177 | $to[] = htmlspecialchars($params['domainname']); 178 | switch (htmlspecialchars($params['op'])) { 179 | case 'request': 180 | $from[] = '/{{ admin }}/'; 181 | $to[] = (int)($params['admin']); 182 | $from[] = '/{{ tech }}/'; 183 | $to[] = (int)($params['tech']); 184 | $from[] = '/{{ years }}/'; 185 | $to[] = (int)($params['years']); 186 | $from[] = '/{{ authInfoPw }}/'; 187 | $to[] = htmlspecialchars($params['authInfoPw']); 188 | $xmltype = 'req'; 189 | break; 190 | case 'query': 191 | $from[] = '/{{ type }}/'; 192 | $to[] = 'query'; 193 | $xmltype = 'oth'; 194 | break; 195 | case 'cancel': 196 | $from[] = '/{{ type }}/'; 197 | $to[] = 'cancel'; 198 | $xmltype = 'oth'; 199 | break; 200 | case 'reject': 201 | $from[] = '/{{ type }}/'; 202 | $to[] = 'reject'; 203 | $xmltype = 'oth'; 204 | break; 205 | case 'approve': 206 | $xmltype = 'apr'; 207 | break; 208 | default: 209 | throw new EppException('Invalid value for transfer:op specified.'); 210 | break; 211 | } 212 | $from[] = '/{{ clTRID }}/'; 213 | $clTRID = str_replace('.', '', round(microtime(1), 3)); 214 | $to[] = htmlspecialchars($this->prefix . '-domain-transfer-' . $clTRID); 215 | $from[] = "/<\w+:\w+>\s*<\/\w+:\w+>\s+/ims"; 216 | $to[] = ''; 217 | if ($xmltype === 'req') { 218 | $xml = preg_replace($from, $to, ' 219 | 222 | 223 | 224 | 226 | {{ name }} 227 | {{ years }} 228 | 229 | {{ authInfoPw }} 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | {{ admin }} 238 | {{ tech }} 239 | 240 | 241 | 242 | 243 | {{ clTRID }} 244 | 245 | '); 246 | } else if ($xmltype === 'apr') { 247 | $xml = preg_replace($from, $to, ' 248 | 251 | 252 | 253 | 255 | {{ name }} 256 | 257 | 258 | {{ clTRID }} 259 | 260 | '); 261 | } else if ($xmltype === 'oth') { 262 | $xml = preg_replace($from, $to, ' 263 | 266 | 267 | 268 | 270 | {{ name }} 271 | 272 | 273 | {{ clTRID }} 274 | 275 | '); 276 | } 277 | 278 | $r = $this->writeRequest($xml); 279 | $code = (int)$r->response->result->attributes()->code; 280 | $msg = (string)$r->response->result->msg; 281 | $r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->trnData; 282 | $name = (string)($r->name ?? 'N/A'); 283 | $trStatus = (string)($r->trStatus ?? 'N/A'); 284 | $reID = (string)($r->reID ?? 'N/A'); 285 | $reDate = (string)($r->reDate ?? 'N/A'); 286 | $acID = (string)($r->acID ?? 'N/A'); 287 | $acDate = (string)($r->acDate ?? 'N/A'); 288 | $exDate = (string)($r->exDate ?? 'N/A'); 289 | 290 | $return = array( 291 | 'code' => $code, 292 | 'msg' => $msg, 293 | 'name' => $name, 294 | 'trStatus' => $trStatus, 295 | 'reID' => $reID, 296 | 'reDate' => $reDate, 297 | 'acID' => $acID, 298 | 'acDate' => $acDate, 299 | 'exDate' => $exDate 300 | ); 301 | 302 | } catch (\Exception $e) { 303 | $return = array( 304 | 'error' => $e->getMessage() 305 | ); 306 | } 307 | 308 | return $return; 309 | } 310 | 311 | /** 312 | * domainCreateClaims 313 | */ 314 | public function domainCreateClaims($params = array()) 315 | { 316 | if (!$this->isLoggedIn) { 317 | return array( 318 | 'code' => 2002, 319 | 'msg' => 'Command use error' 320 | ); 321 | } 322 | 323 | throw new EppException("Launch extension not supported!"); 324 | } 325 | 326 | /** 327 | * domainCreateSunrise 328 | */ 329 | public function domainCreateSunrise($params = array()) 330 | { 331 | if (!$this->isLoggedIn) { 332 | return array( 333 | 'code' => 2002, 334 | 'msg' => 'Command use error' 335 | ); 336 | } 337 | 338 | throw new EppException("Launch extension not supported!"); 339 | } 340 | 341 | public function _response_log($content) 342 | { 343 | // Add formatted content to the log 344 | $this->responseLogger->info($content); 345 | $this->commonLogger->info($content); 346 | } 347 | 348 | public function _request_log($content) 349 | { 350 | // Add formatted content to the log 351 | $this->requestLogger->info($content); 352 | $this->commonLogger->info($content); 353 | } 354 | } 355 | -------------------------------------------------------------------------------- /src/Registries/GenericEpp.php: -------------------------------------------------------------------------------- 1 | resource = curl_exec($ch); 50 | 51 | if (!$this->resource) { 52 | throw new EppException("Cannot connect to server '{$host}': {$errmsg}"); 53 | } 54 | 55 | $this->ch = $ch; 56 | return $this->readResponse(); 57 | } 58 | 59 | /** 60 | * readResponse 61 | */ 62 | public function readResponse() 63 | { 64 | try { 65 | $return = curl_exec($this->ch); 66 | $xml = preg_replace('/>\n<", $return); 67 | $this->_response_log($xml); 68 | } catch (\EppException $e) { 69 | $code = curl_errno($this->ch); 70 | $msg = curl_error($this->ch); 71 | throw new \EppException($msg, $code); 72 | } 73 | 74 | return $xml; 75 | } 76 | 77 | /** 78 | * writeRequest 79 | */ 80 | public function writeRequest($xml) 81 | { 82 | $this->_request_log($xml); 83 | curl_setopt($this->ch, CURLOPT_POST, true); 84 | curl_setopt($this->ch, CURLOPT_POSTFIELDS, $xml); 85 | $r = simplexml_load_string($this->readResponse()); 86 | if ($r->response->result->attributes()->code >= 2000) { 87 | throw new EppException($r->response->result->msg); 88 | } 89 | 90 | return $r; 91 | } 92 | 93 | /** 94 | * disconnect 95 | */ 96 | public function disconnect() 97 | { 98 | return curl_close($this->ch); 99 | } 100 | 101 | protected function addLoginExtensions(\XMLWriter $xml): void 102 | { 103 | $xml->startElement('svcExtension'); 104 | $xml->writeElement('extURI', 'urn:ietf:params:xml:ns:secDNS-1.1'); 105 | $xml->endElement(); // svcExtension 106 | } 107 | 108 | /** 109 | * domainCheckClaims 110 | */ 111 | public function domainCheckClaims($params = array()) 112 | { 113 | if (!$this->isLoggedIn) { 114 | return array( 115 | 'code' => 2002, 116 | 'msg' => 'Command use error' 117 | ); 118 | } 119 | 120 | throw new EppException("Launch extension not supported!"); 121 | } 122 | 123 | /** 124 | * domainUpdateContact 125 | */ 126 | public function domainUpdateContact($params = array()) 127 | { 128 | if (!$this->isLoggedIn) { 129 | return array( 130 | 'code' => 2002, 131 | 'msg' => 'Command use error' 132 | ); 133 | } 134 | 135 | $return = array(); 136 | try { 137 | $from = $to = array(); 138 | $from[] = '/{{ name }}/'; 139 | $to[] = htmlspecialchars($params['domainname']); 140 | if ($params['contacttype'] === 'registrant') { 141 | $from[] = '/{{ add }}/'; 142 | $to[] = ""; 143 | $from[] = '/{{ rem }}/'; 144 | $to[] = ""; 145 | $from[] = '/{{ chg }}/'; 146 | $to[] = "".htmlspecialchars($params['new_contactid'])."\n"; 147 | $from[] = '/{{ ext }}/'; 148 | $to[] = " 149 | ownerNameChange 150 | 151 | "; 152 | } else { 153 | $from[] = '/{{ add }}/'; 154 | $to[] = "".htmlspecialchars($params['new_contactid'])."\n"; 155 | $from[] = '/{{ rem }}/'; 156 | $to[] = "".htmlspecialchars($params['old_contactid'])."\n"; 157 | $from[] = '/{{ chg }}/'; 158 | $to[] = ""; 159 | $from[] = '/{{ ext }}/'; 160 | $to[] = ""; 161 | } 162 | $from[] = '/{{ clTRID }}/'; 163 | $clTRID = str_replace('.', '', round(microtime(1), 3)); 164 | $to[] = htmlspecialchars($this->prefix . '-domain-updateContact-' . $clTRID); 165 | $from[] = "/<\w+:\w+>\s*<\/\w+:\w+>\s+/ims"; 166 | $to[] = ''; 167 | $xml = preg_replace($from, $to, ' 168 | 171 | 172 | 173 | 176 | {{ name }} 177 | {{ add }} 178 | {{ rem }} 179 | {{ chg }} 180 | 181 | 182 | {{ ext }} 183 | {{ clTRID }} 184 | 185 | '); 186 | $r = $this->writeRequest($xml); 187 | $code = (int)$r->response->result->attributes()->code; 188 | $msg = (string)$r->response->result->msg; 189 | 190 | $return = array( 191 | 'code' => $code, 192 | 'msg' => $msg 193 | ); 194 | } catch (\Exception $e) { 195 | $return = array( 196 | 'error' => $e->getMessage() 197 | ); 198 | } 199 | 200 | return $return; 201 | } 202 | 203 | /** 204 | * domainUpdateStatus 205 | */ 206 | public function domainUpdateStatus($params = array()) 207 | { 208 | if (!$this->isLoggedIn) { 209 | return array( 210 | 'code' => 2002, 211 | 'msg' => 'Command use error' 212 | ); 213 | } 214 | 215 | throw new EppException("Status update not supported!"); 216 | } 217 | 218 | /** 219 | * domainTransfer 220 | */ 221 | public function domainTransfer($params = array()) 222 | { 223 | if (!$this->isLoggedIn) { 224 | return array( 225 | 'code' => 2002, 226 | 'msg' => 'Command use error' 227 | ); 228 | } 229 | 230 | $return = array(); 231 | try { 232 | $from = $to = array(); 233 | $from[] = '/{{ name }}/'; 234 | $to[] = htmlspecialchars($params['domainname']); 235 | switch (htmlspecialchars($params['op'])) { 236 | case 'request': 237 | $from[] = '/{{ years }}/'; 238 | $to[] = (int)($params['years']); 239 | $from[] = '/{{ authInfoPw }}/'; 240 | $to[] = htmlspecialchars($params['authInfoPw']); 241 | $from[] = '/{{ registrant }}/'; 242 | $to[] = htmlspecialchars($params['registrant']); 243 | $from[] = '/{{ new_authInfoPw }}/'; 244 | $to[] = htmlspecialchars($params['new_authInfoPw']); 245 | $xmltype = 'req'; 246 | break; 247 | case 'query': 248 | $from[] = '/{{ type }}/'; 249 | $to[] = 'query'; 250 | $xmltype = 'oth'; 251 | break; 252 | case 'cancel': 253 | $from[] = '/{{ type }}/'; 254 | $to[] = 'cancel'; 255 | $xmltype = 'oth'; 256 | break; 257 | case 'reject': 258 | $from[] = '/{{ type }}/'; 259 | $to[] = 'reject'; 260 | $xmltype = 'oth'; 261 | break; 262 | case 'approve': 263 | $xmltype = 'apr'; 264 | break; 265 | default: 266 | throw new EppException('Invalid value for transfer:op specified.'); 267 | break; 268 | } 269 | $from[] = '/{{ clTRID }}/'; 270 | $clTRID = str_replace('.', '', round(microtime(1), 3)); 271 | $to[] = htmlspecialchars($this->prefix . '-domain-transfer-' . $clTRID); 272 | $from[] = "/<\w+:\w+>\s*<\/\w+:\w+>\s+/ims"; 273 | $to[] = ''; 274 | if ($xmltype === 'req') { 275 | $xml = preg_replace($from, $to, ' 276 | 279 | 280 | 281 | 283 | {{ name }} 284 | {{ years }} 285 | 286 | {{ authInfoPw }} 287 | 288 | 289 | 290 | 291 | 292 | {{ registrant }} 293 | {{ new_authInfoPw }} 294 | 295 | 296 | {{ clTRID }} 297 | 298 | '); 299 | } else if ($xmltype === 'apr') { 300 | $xml = preg_replace($from, $to, ' 301 | 304 | 305 | 306 | 308 | {{ name }} 309 | 310 | 311 | {{ clTRID }} 312 | 313 | '); 314 | } else if ($xmltype === 'oth') { 315 | $xml = preg_replace($from, $to, ' 316 | 319 | 320 | 321 | 323 | {{ name }} 324 | 325 | 326 | {{ clTRID }} 327 | 328 | '); 329 | } 330 | 331 | $r = $this->writeRequest($xml); 332 | $code = (int)$r->response->result->attributes()->code; 333 | $msg = (string)$r->response->result->msg; 334 | $r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->trnData; 335 | $name = (string)($r->name ?? 'N/A'); 336 | $trStatus = (string)($r->trStatus ?? 'N/A'); 337 | $reID = (string)($r->reID ?? 'N/A'); 338 | $reDate = (string)($r->reDate ?? 'N/A'); 339 | $acID = (string)($r->acID ?? 'N/A'); 340 | $acDate = (string)($r->acDate ?? 'N/A'); 341 | $exDate = (string)($r->exDate ?? 'N/A'); 342 | 343 | $return = array( 344 | 'code' => $code, 345 | 'msg' => $msg, 346 | 'name' => $name, 347 | 'trStatus' => $trStatus, 348 | 'reID' => $reID, 349 | 'reDate' => $reDate, 350 | 'acID' => $acID, 351 | 'acDate' => $acDate, 352 | 'exDate' => $exDate 353 | ); 354 | 355 | } catch (\Exception $e) { 356 | $return = array( 357 | 'error' => $e->getMessage() 358 | ); 359 | } 360 | 361 | return $return; 362 | } 363 | 364 | /** 365 | * domainCreateClaims 366 | */ 367 | public function domainCreateClaims($params = array()) 368 | { 369 | if (!$this->isLoggedIn) { 370 | return array( 371 | 'code' => 2002, 372 | 'msg' => 'Command use error' 373 | ); 374 | } 375 | 376 | throw new EppException("Launch extension not supported!"); 377 | } 378 | 379 | /** 380 | * domainCreateSunrise 381 | */ 382 | public function domainCreateSunrise($params = array()) 383 | { 384 | if (!$this->isLoggedIn) { 385 | return array( 386 | 'code' => 2002, 387 | 'msg' => 'Command use error' 388 | ); 389 | } 390 | 391 | throw new EppException("Launch extension not supported!"); 392 | } 393 | 394 | /** 395 | * domainCreateDNSSEC 396 | */ 397 | public function domainCreateDNSSEC($params = array()) 398 | { 399 | if (!$this->isLoggedIn) { 400 | return array( 401 | 'code' => 2002, 402 | 'msg' => 'Command use error' 403 | ); 404 | } 405 | 406 | $return = array(); 407 | try { 408 | $from = $to = array(); 409 | $from[] = '/{{ name }}/'; 410 | $to[] = htmlspecialchars($params['domainname']); 411 | $from[] = '/{{ period }}/'; 412 | $to[] = (int)($params['period']); 413 | if (isset($params['nss'])) { 414 | $text = ''; 415 | foreach ($params['nss'] as $hostObj) { 416 | $text .= '' . $hostObj . '' . "\n"; 417 | } 418 | $from[] = '/{{ hostObjs }}/'; 419 | $to[] = $text; 420 | } else { 421 | $from[] = '/{{ hostObjs }}/'; 422 | $to[] = ''; 423 | } 424 | $from[] = '/{{ registrant }}/'; 425 | $to[] = htmlspecialchars($params['registrant']); 426 | $text = ''; 427 | foreach ($params['contacts'] as $id => $contactType) { 428 | $text .= '' . $id . '' . "\n"; 429 | } 430 | $from[] = '/{{ contacts }}/'; 431 | $to[] = $text; 432 | if ($params['dnssec_records'] == 1) { 433 | $from[] = '/{{ dnssec_data }}/'; 434 | $to[] = " 435 | ".htmlspecialchars($params['keyTag_1'])." 436 | ".htmlspecialchars($params['alg_1'])." 437 | ".htmlspecialchars($params['digestType_1'])." 438 | ".htmlspecialchars($params['digest_1'])." 439 | "; 440 | } else if ($params['dnssec_records'] == 2) { 441 | $from[] = '/{{ dnssec_data }}/'; 442 | $to[] = " 443 | ".htmlspecialchars($params['keyTag_1'])." 444 | ".htmlspecialchars($params['alg_1'])." 445 | ".htmlspecialchars($params['digestType_1'])." 446 | ".htmlspecialchars($params['digest_1'])." 447 | 448 | 449 | ".htmlspecialchars($params['keyTag_2'])." 450 | ".htmlspecialchars($params['alg_2'])." 451 | ".htmlspecialchars($params['digestType_2'])." 452 | ".htmlspecialchars($params['digest_2'])." 453 | "; 454 | } 455 | $from[] = '/{{ authInfoPw }}/'; 456 | $to[] = htmlspecialchars($params['authInfoPw']); 457 | $from[] = '/{{ clTRID }}/'; 458 | $clTRID = str_replace('.', '', round(microtime(1), 3)); 459 | $to[] = htmlspecialchars($this->prefix . '-domain-createDNSSEC-' . $clTRID); 460 | $from[] = "/<\w+:\w+>\s*<\/\w+:\w+>\s+/ims"; 461 | $to[] = ''; 462 | $xml = preg_replace($from, $to, ' 463 | 466 | 467 | 468 | 470 | {{ name }} 471 | {{ period }} 472 | 473 | {{ hostObjs }} 474 | 475 | {{ registrant }} 476 | {{ contacts }} 477 | 478 | {{ authInfoPw }} 479 | 480 | 481 | 482 | 483 | 484 | {{ dnssec_data }} 485 | 486 | 487 | {{ clTRID }} 488 | 489 | '); 490 | $r = $this->writeRequest($xml); 491 | $code = (int)$r->response->result->attributes()->code; 492 | $msg = (string)$r->response->result->msg; 493 | $r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->creData; 494 | $name = (string)$r->name; 495 | $crDate = (string)$r->crDate; 496 | $exDate = (string)$r->exDate; 497 | 498 | $return = array( 499 | 'code' => $code, 500 | 'msg' => $msg, 501 | 'name' => $name, 502 | 'crDate' => $crDate, 503 | 'exDate' => $exDate 504 | ); 505 | } catch (\Exception $e) { 506 | $return = array( 507 | 'error' => $e->getMessage() 508 | ); 509 | } 510 | 511 | return $return; 512 | } 513 | 514 | /** 515 | * domainDelete 516 | */ 517 | public function domainDelete($params = array()) 518 | { 519 | if (!$this->isLoggedIn) { 520 | return array( 521 | 'code' => 2002, 522 | 'msg' => 'Command use error' 523 | ); 524 | } 525 | 526 | $return = array(); 527 | try { 528 | $from = $to = array(); 529 | $from[] = '/{{ name }}/'; 530 | $to[] = htmlspecialchars($params['domainname']); 531 | $from[] = '/{{ password }}/'; 532 | $to[] = htmlspecialchars($params['password']); 533 | $from[] = '/{{ clTRID }}/'; 534 | $clTRID = str_replace('.', '', round(microtime(1), 3)); 535 | $to[] = htmlspecialchars($this->prefix . '-domain-delete-' . $clTRID); 536 | $from[] = "/<\w+:\w+>\s*<\/\w+:\w+>\s+/ims"; 537 | $to[] = ''; 538 | $xml = preg_replace($from, $to, ' 539 | 542 | 543 | 544 | 546 | {{ name }} 547 | 548 | 549 | 550 | 551 | {{ password }} 552 | deleteDomain 553 | 554 | 555 | {{ clTRID }} 556 | 557 | '); 558 | $r = $this->writeRequest($xml); 559 | $code = (int)$r->response->result->attributes()->code; 560 | $msg = (string)$r->response->result->msg; 561 | 562 | $return = array( 563 | 'code' => $code, 564 | 'msg' => $msg 565 | ); 566 | } catch (\Exception $e) { 567 | $return = array( 568 | 'error' => $e->getMessage() 569 | ); 570 | } 571 | 572 | return $return; 573 | } 574 | 575 | /** 576 | * domainRestore 577 | */ 578 | public function domainRestore($params = array()) 579 | { 580 | if (!$this->isLoggedIn) { 581 | return array( 582 | 'code' => 2002, 583 | 'msg' => 'Command use error' 584 | ); 585 | } 586 | 587 | throw new EppException("RGP extension not supported!"); 588 | } 589 | 590 | /** 591 | * domainReport 592 | */ 593 | public function domainReport($params = array()) 594 | { 595 | if (!$this->isLoggedIn) { 596 | return array( 597 | 'code' => 2002, 598 | 'msg' => 'Command use error' 599 | ); 600 | } 601 | 602 | throw new EppException("RGP extension not supported!"); 603 | } 604 | 605 | public function _response_log($content) 606 | { 607 | // Add formatted content to the log 608 | $this->responseLogger->info($content); 609 | $this->commonLogger->info($content); 610 | } 611 | 612 | public function _request_log($content) 613 | { 614 | // Add formatted content to the log 615 | $this->requestLogger->info($content); 616 | $this->commonLogger->info($content); 617 | } 618 | } 619 | -------------------------------------------------------------------------------- /src/Registries/HrEpp.php: -------------------------------------------------------------------------------- 1 | writeElement('objURI', 'urn:ietf:params:xml:ns:domain-1.0'); 26 | $xml->writeElement('objURI', 'urn:ietf:params:xml:ns:contact-1.0'); 27 | } 28 | 29 | protected function addLoginExtensions(\XMLWriter $xml): void 30 | { 31 | $xml->startElement('svcExtension'); 32 | $xml->writeElement('extURI', 'http://www.dns.hr/epp/hr-1.0'); 33 | $xml->endElement(); // svcExtension 34 | } 35 | 36 | /** 37 | * hostCheck 38 | */ 39 | public function hostCheck($params = array()) 40 | { 41 | if (!$this->isLoggedIn) { 42 | return array( 43 | 'code' => 2002, 44 | 'msg' => 'Command use error' 45 | ); 46 | } 47 | 48 | throw new EppException("Hosts are not supported!"); 49 | } 50 | 51 | /** 52 | * hostInfo 53 | */ 54 | public function hostInfo($params = array()) 55 | { 56 | if (!$this->isLoggedIn) { 57 | return array( 58 | 'code' => 2002, 59 | 'msg' => 'Command use error' 60 | ); 61 | } 62 | 63 | throw new EppException("Hosts are not supported!"); 64 | } 65 | 66 | /** 67 | * hostCreate 68 | */ 69 | public function hostCreate($params = array()) 70 | { 71 | if (!$this->isLoggedIn) { 72 | return array( 73 | 'code' => 2002, 74 | 'msg' => 'Command use error' 75 | ); 76 | } 77 | 78 | throw new EppException("Hosts are not supported!"); 79 | } 80 | 81 | /** 82 | * hostUpdate 83 | */ 84 | public function hostUpdate($params = array()) 85 | { 86 | if (!$this->isLoggedIn) { 87 | return array( 88 | 'code' => 2002, 89 | 'msg' => 'Command use error' 90 | ); 91 | } 92 | 93 | throw new EppException("Hosts are not supported!"); 94 | } 95 | 96 | /** 97 | * hostDelete 98 | */ 99 | public function hostDelete($params = array()) 100 | { 101 | if (!$this->isLoggedIn) { 102 | return array( 103 | 'code' => 2002, 104 | 'msg' => 'Command use error' 105 | ); 106 | } 107 | 108 | throw new EppException("Hosts are not supported!"); 109 | } 110 | 111 | /** 112 | * contactCreate 113 | */ 114 | public function contactCreate($params = array()) 115 | { 116 | if (!$this->isLoggedIn) { 117 | return array( 118 | 'code' => 2002, 119 | 'msg' => 'Command use error' 120 | ); 121 | } 122 | 123 | $return = array(); 124 | try { 125 | $from = $to = array(); 126 | $from[] = '/{{ type }}/'; 127 | $to[] = htmlspecialchars($params['type']); 128 | $from[] = '/{{ id }}/'; 129 | $to[] = htmlspecialchars($params['id']); 130 | $from[] = '/{{ name }}/'; 131 | $to[] = htmlspecialchars($params['firstname'] . ' ' . $params['lastname']); 132 | $from[] = '/{{ org }}/'; 133 | $to[] = htmlspecialchars($params['companyname']); 134 | $from[] = '/{{ street1 }}/'; 135 | $to[] = htmlspecialchars($params['address1']); 136 | $from[] = '/{{ street2 }}/'; 137 | $to[] = htmlspecialchars($params['address2']); 138 | $from[] = '/{{ street3 }}/'; 139 | $street3 = (isset($params['address3']) ? $params['address3'] : ''); 140 | $to[] = htmlspecialchars($street3); 141 | $from[] = '/{{ city }}/'; 142 | $to[] = htmlspecialchars($params['city']); 143 | $from[] = '/{{ state }}/'; 144 | $to[] = htmlspecialchars($params['state']); 145 | $from[] = '/{{ postcode }}/'; 146 | $to[] = htmlspecialchars($params['postcode']); 147 | $from[] = '/{{ country }}/'; 148 | $to[] = htmlspecialchars($params['country']); 149 | $from[] = '/{{ phonenumber }}/'; 150 | $to[] = htmlspecialchars($params['fullphonenumber']); 151 | $from[] = '/{{ email }}/'; 152 | $to[] = htmlspecialchars($params['email']); 153 | $from[] = '/{{ authInfo }}/'; 154 | $to[] = htmlspecialchars($params['authInfoPw']); 155 | $from[] = '/{{ nin_type }}/'; 156 | $to[] = htmlspecialchars($params['nin_type']); 157 | $from[] = '/{{ nin }}/'; 158 | $to[] = htmlspecialchars($params['nin']); 159 | $from[] = '/{{ clTRID }}/'; 160 | $microtime = str_replace('.', '', round(microtime(1), 3)); 161 | $to[] = htmlspecialchars($this->prefix . '-contact-create-' . $microtime); 162 | $from[] = "/<\w+:\w+>\s*<\/\w+:\w+>\s+/ims"; 163 | $to[] = ''; 164 | $xml = preg_replace($from, $to, ' 165 | 166 | 167 | 168 | 170 | {{ id }} 171 | 172 | {{ name }} 173 | {{ org }} 174 | 175 | {{ street1 }} 176 | {{ street2 }} 177 | {{ street3 }} 178 | {{ city }} 179 | {{ state }} 180 | {{ postcode }} 181 | {{ country }} 182 | 183 | 184 | {{ phonenumber }} 185 | 186 | {{ email }} 187 | 188 | {{ authInfo }} 189 | 190 | 191 | 192 | 193 | 194 | 195 | {{ nin_type }} 196 | {{ nin }} 197 | 198 | 199 | 200 | {{ clTRID }} 201 | 202 | '); 203 | $r = $this->writeRequest($xml); 204 | $code = (int)$r->response->result->attributes()->code; 205 | $msg = (string)$r->response->result->msg; 206 | $r = $r->response->resData->children('urn:ietf:params:xml:ns:contact-1.0')->creData; 207 | $id = (string)$r->id; 208 | 209 | $return = array( 210 | 'code' => $code, 211 | 'msg' => $msg, 212 | 'id' => $id 213 | ); 214 | } catch (\Exception $e) { 215 | $return = array( 216 | 'error' => $e->getMessage() 217 | ); 218 | } 219 | 220 | return $return; 221 | } 222 | 223 | /** 224 | * domainCheckClaims 225 | */ 226 | public function domainCheckClaims($params = array()) 227 | { 228 | if (!$this->isLoggedIn) { 229 | return array( 230 | 'code' => 2002, 231 | 'msg' => 'Command use error' 232 | ); 233 | } 234 | 235 | throw new EppException("Domain check claims is not supported!"); 236 | } 237 | 238 | /** 239 | * domainInfo 240 | */ 241 | public function domainInfo($params = array()) 242 | { 243 | if (!$this->isLoggedIn) { 244 | return array( 245 | 'code' => 2002, 246 | 'msg' => 'Command use error' 247 | ); 248 | } 249 | 250 | $return = array(); 251 | try { 252 | $from = $to = array(); 253 | $from[] = '/{{ domainname }}/'; 254 | $to[] = htmlspecialchars($params['domainname']); 255 | $from[] = '/{{ authInfo }}/'; 256 | $authInfo = (isset($params['authInfoPw']) ? "\n\n" : ''); 257 | $to[] = $authInfo; 258 | $from[] = '/{{ clTRID }}/'; 259 | $microtime = str_replace('.', '', round(microtime(1), 3)); 260 | $to[] = htmlspecialchars($this->prefix . '-domain-info-' . $microtime); 261 | $from[] = "/<\w+:\w+>\s*<\/\w+:\w+>\s+/ims"; 262 | $to[] = ''; 263 | $xml = preg_replace($from, $to, ' 264 | 267 | 268 | 269 | 272 | {{ domainname }} 273 | {{ authInfo }} 274 | 275 | 276 | {{ clTRID }} 277 | 278 | '); 279 | $r = $this->writeRequest($xml); 280 | $code = (int)$r->response->result->attributes()->code; 281 | $msg = (string)$r->response->result->msg; 282 | $r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->infData; 283 | $name = (string)$r->name; 284 | $roid = (string)$r->roid; 285 | $status = array(); 286 | $i = 0; 287 | foreach ($r->status as $e) { 288 | $i++; 289 | $status[$i] = (string)$e->attributes()->s; 290 | } 291 | $registrant = (string)$r->registrant; 292 | $contact = array(); 293 | $i = 0; 294 | foreach ($r->contact as $e) { 295 | $i++; 296 | $contact[$i]['type'] = (string)$e->attributes()->type; 297 | $contact[$i]['id'] = (string)$e; 298 | } 299 | $ns = array(); 300 | $i = 0; 301 | foreach ($r->ns->hostAttr as $hostAttr) { 302 | $i++; 303 | $ns[$i] = (string)$hostAttr->hostName; 304 | } 305 | $host = array(); 306 | $i = 0; 307 | foreach ($r->host as $hostname) { 308 | $i++; 309 | $host[$i] = (string)$hostname; 310 | } 311 | $clID = (string)$r->clID; 312 | $crID = (string)$r->crID; 313 | $crDate = (string)$r->crDate; 314 | $upID = (string)$r->upID; 315 | $upDate = (string)$r->upDate; 316 | $exDate = (string)$r->exDate; 317 | $trDate = (string)$r->trDate; 318 | $authInfo = (string)$r->authInfo->pw; 319 | 320 | $return = array( 321 | 'code' => $code, 322 | 'msg' => $msg, 323 | 'name' => $name, 324 | 'roid' => $roid, 325 | 'status' => $status, 326 | 'registrant' => $registrant, 327 | 'contact' => $contact, 328 | 'ns' => $ns, 329 | 'host' => $host, 330 | 'clID' => $clID, 331 | 'crID' => $crID, 332 | 'crDate' => $crDate, 333 | 'upID' => $upID, 334 | 'upDate' => $upDate, 335 | 'exDate' => $exDate, 336 | 'trDate' => $trDate, 337 | 'authInfo' => $authInfo 338 | ); 339 | } catch (\Exception $e) { 340 | $return = array( 341 | 'error' => $e->getMessage() 342 | ); 343 | } 344 | 345 | return $return; 346 | } 347 | 348 | /** 349 | * domainUpdateNS 350 | */ 351 | public function domainUpdateNS($params = array()) 352 | { 353 | if (!$this->isLoggedIn) { 354 | return array( 355 | 'code' => 2002, 356 | 'msg' => 'Command use error' 357 | ); 358 | } 359 | 360 | $return = array(); 361 | try { 362 | // Step 1: Fetch current nameservers via domain info 363 | $from = $to = array(); 364 | $from[] = '/{{ name }}/'; 365 | $to[] = htmlspecialchars($params['domainname']); 366 | $from[] = '/{{ clTRID }}/'; 367 | $clTRID = str_replace('.', '', round(microtime(1), 3)); 368 | $to[] = htmlspecialchars($this->prefix . '-domain-info-' . $clTRID); 369 | $xml = preg_replace($from, $to, ' 370 | 373 | 374 | 375 | 378 | {{ name }} 379 | 380 | 381 | {{ clTRID }} 382 | 383 | '); 384 | $r = $this->writeRequest($xml); 385 | $r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->infData; 386 | 387 | // Step 2: Parse existing nameservers 388 | $currentNs = array(); 389 | foreach ($r->ns->hostAttr as $hostAttr) { 390 | $hostName = (string)$hostAttr->hostName; 391 | 392 | // Initialize IPv4 and IPv6 as empty 393 | $ipv4 = ''; 394 | $ipv6 = ''; 395 | 396 | // Parse elements 397 | foreach ($hostAttr->hostAddr as $hostAddr) { 398 | $ipType = (string)$hostAddr->attributes()->ip; // Get the 'ip' attribute (v4 or v6) 399 | if ($ipType === 'v4') { 400 | $ipv4 = (string)$hostAddr; 401 | } elseif ($ipType === 'v6') { 402 | $ipv6 = (string)$hostAddr; 403 | } 404 | } 405 | 406 | // Add to the current nameservers list 407 | $currentNs[$hostName] = array_filter([ 408 | 'hostName' => $hostName, 409 | 'ipv4' => $ipv4, 410 | 'ipv6' => $ipv6 411 | ]); 412 | } 413 | 414 | // Step 3: Determine changes (additions, removals) 415 | $add = $rem = array(); 416 | foreach ($params['nss'] as $ns) { 417 | if (is_array($ns)) { 418 | $hostName = $ns['hostName']; 419 | $ipv4 = $ns['ipv4'] ?? ''; 420 | $ipv6 = $ns['ipv6'] ?? ''; 421 | $nsKey = $hostName . ($ipv4 ? "|v4:$ipv4" : '') . ($ipv6 ? "|v6:$ipv6" : ''); 422 | 423 | if (!isset($currentNs[$hostName]) || $currentNs[$hostName] != $ns) { 424 | $add[$nsKey] = $ns; 425 | } 426 | } else { 427 | // Handle simple hostObj case 428 | if (!isset($currentNs[$ns])) { 429 | $add[$ns] = ['hostName' => $ns]; 430 | } 431 | } 432 | } 433 | 434 | foreach ($currentNs as $hostName => $nsData) { 435 | if (!in_array($hostName, array_column($params['nss'], 'hostName'))) { 436 | $rem[$hostName] = $nsData; 437 | } 438 | } 439 | 440 | // Step 4: Generate update XML 441 | if (!empty($add) || !empty($rem)) { 442 | $from = $to = array(); 443 | $addXml = ''; 444 | foreach ($add as $ns) { 445 | $addXml .= ''; 446 | $addXml .= '' . htmlspecialchars($ns['hostName']) . ''; 447 | if (!empty($ns['ipv4'])) { 448 | $addXml .= '' . htmlspecialchars($ns['ipv4']) . ''; 449 | } 450 | if (!empty($ns['ipv6'])) { 451 | $addXml .= '' . htmlspecialchars($ns['ipv6']) . ''; 452 | } 453 | $addXml .= '' . "\n"; 454 | } 455 | 456 | $from[] = '/{{ add }}/'; 457 | $to[] = (empty($addXml) ? '' : "\n{$addXml}\n"); 458 | 459 | $remXml = ''; 460 | foreach ($rem as $ns) { 461 | $remXml .= ''; 462 | $remXml .= '' . htmlspecialchars($ns['hostName']) . ''; 463 | if (!empty($ns['ipv4'])) { 464 | $remXml .= '' . htmlspecialchars($ns['ipv4']) . ''; 465 | } 466 | if (!empty($ns['ipv6'])) { 467 | $remXml .= '' . htmlspecialchars($ns['ipv6']) . ''; 468 | } 469 | $remXml .= '' . "\n"; 470 | } 471 | 472 | $from[] = '/{{ rem }}/'; 473 | $to[] = (empty($remXml) ? '' : "\n{$remXml}\n"); 474 | $from[] = '/{{ name }}/'; 475 | $to[] = htmlspecialchars($params['domainname']); 476 | $from[] = '/{{ clTRID }}/'; 477 | $clTRID = str_replace('.', '', round(microtime(1), 3)); 478 | $to[] = htmlspecialchars($this->prefix . '-domain-updateNS-' . $clTRID); 479 | 480 | $xml = preg_replace($from, $to, ' 481 | 484 | 485 | 486 | 489 | {{ name }} 490 | {{ add }} 491 | {{ rem }} 492 | 493 | 494 | {{ clTRID }} 495 | 496 | '); 497 | $r = $this->writeRequest($xml); 498 | $code = (int)$r->response->result->attributes()->code; 499 | $msg = (string)$r->response->result->msg; 500 | 501 | $return = array( 502 | 'code' => $code, 503 | 'msg' => $msg 504 | ); 505 | } 506 | } catch (\Exception $e) { 507 | $return = array( 508 | 'error' => $e->getMessage() 509 | ); 510 | } 511 | 512 | return $return; 513 | } 514 | 515 | /** 516 | * domainCreate 517 | */ 518 | public function domainCreate($params = array()) 519 | { 520 | if (!$this->isLoggedIn) { 521 | return array( 522 | 'code' => 2002, 523 | 'msg' => 'Command use error' 524 | ); 525 | } 526 | 527 | $return = array(); 528 | try { 529 | $from = $to = array(); 530 | $from[] = '/{{ name }}/'; 531 | $to[] = htmlspecialchars($params['domainname']); 532 | $from[] = '/{{ period }}/'; 533 | $to[] = (int)($params['period']); 534 | if (isset($params['nss'])) { 535 | $text = ''; 536 | foreach ($params['nss'] as $hostAttr) { 537 | $text .= ''; 538 | $text .= '' . htmlspecialchars($hostAttr['hostName']) . ''; 539 | if (!empty($hostAttr['ipv4'])) { 540 | $text .= '' . htmlspecialchars($hostAttr['ipv4']) . ''; 541 | } 542 | if (!empty($hostAttr['ipv6'])) { 543 | $text .= '' . htmlspecialchars($hostAttr['ipv6']) . ''; 544 | } 545 | 546 | $text .= '' . "\n"; 547 | } 548 | $from[] = '/{{ hostAttr }}/'; 549 | $to[] = $text; 550 | } else { 551 | $from[] = '/{{ hostAttr }}/'; 552 | $to[] = ''; 553 | } 554 | $from[] = '/{{ registrant }}/'; 555 | $to[] = htmlspecialchars($params['registrant']); 556 | $text = ''; 557 | foreach ($params['contacts'] as $contactType => $contactID) { 558 | $text .= '' . $contactID . '' . "\n"; 559 | } 560 | $from[] = '/{{ contacts }}/'; 561 | $to[] = $text; 562 | $from[] = '/{{ authInfoPw }}/'; 563 | $to[] = htmlspecialchars($params['authInfoPw']); 564 | $from[] = '/{{ clTRID }}/'; 565 | $clTRID = str_replace('.', '', round(microtime(1), 3)); 566 | $to[] = htmlspecialchars($this->prefix . '-domain-create-' . $clTRID); 567 | $from[] = "/<\w+:\w+>\s*<\/\w+:\w+>\s+/ims"; 568 | $to[] = ''; 569 | $xml = preg_replace($from, $to, ' 570 | 573 | 574 | 575 | 577 | {{ name }} 578 | {{ period }} 579 | 580 | {{ hostAttr }} 581 | 582 | {{ registrant }} 583 | {{ contacts }} 584 | 585 | {{ authInfoPw }} 586 | 587 | 588 | 589 | {{ clTRID }} 590 | 591 | '); 592 | $r = $this->writeRequest($xml); 593 | $code = (int)$r->response->result->attributes()->code; 594 | $msg = (string)$r->response->result->msg; 595 | $r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->creData; 596 | $name = (string)$r->name; 597 | $crDate = (string)$r->crDate; 598 | $exDate = (string)$r->exDate; 599 | 600 | $return = array( 601 | 'code' => $code, 602 | 'msg' => $msg, 603 | 'name' => $name, 604 | 'crDate' => $crDate, 605 | 'exDate' => $exDate 606 | ); 607 | } catch (\Exception $e) { 608 | $return = array( 609 | 'error' => $e->getMessage() 610 | ); 611 | } 612 | 613 | return $return; 614 | } 615 | 616 | /** 617 | * domainCreateDNSSEC 618 | */ 619 | public function domainCreateDNSSEC($params = array()) 620 | { 621 | if (!$this->isLoggedIn) { 622 | return array( 623 | 'code' => 2002, 624 | 'msg' => 'Command use error' 625 | ); 626 | } 627 | 628 | $return = array(); 629 | try { 630 | $from = $to = array(); 631 | $from[] = '/{{ name }}/'; 632 | $to[] = htmlspecialchars($params['domainname']); 633 | $from[] = '/{{ period }}/'; 634 | $to[] = (int)($params['period']); 635 | if (isset($params['nss'])) { 636 | $text = ''; 637 | foreach ($params['nss'] as $hostAttr) { 638 | $text .= ''; 639 | $text .= '' . htmlspecialchars($hostAttr['hostName']) . ''; 640 | if (!empty($hostAttr['ipv4'])) { 641 | $text .= '' . htmlspecialchars($hostAttr['ipv4']) . ''; 642 | } 643 | if (!empty($hostAttr['ipv6'])) { 644 | $text .= '' . htmlspecialchars($hostAttr['ipv6']) . ''; 645 | } 646 | 647 | $text .= '' . "\n"; 648 | } 649 | $from[] = '/{{ hostAttr }}/'; 650 | $to[] = $text; 651 | } else { 652 | $from[] = '/{{ hostAttr }}/'; 653 | $to[] = ''; 654 | } 655 | $from[] = '/{{ registrant }}/'; 656 | $to[] = htmlspecialchars($params['registrant']); 657 | $text = ''; 658 | foreach ($params['contacts'] as $contactType => $contactID) { 659 | $text .= '' . $contactID . '' . "\n"; 660 | } 661 | $from[] = '/{{ contacts }}/'; 662 | $to[] = $text; 663 | $from[] = '/{{ authInfoPw }}/'; 664 | $to[] = htmlspecialchars($params['authInfoPw']); 665 | if ($params['dnssec_records'] == 1) { 666 | $from[] = '/{{ dnssec_data }}/'; 667 | $to[] = " 668 | ".htmlspecialchars($params['keyTag_1'])." 669 | ".htmlspecialchars($params['alg_1'])." 670 | ".htmlspecialchars($params['digestType_1'])." 671 | ".htmlspecialchars($params['digest_1'])." 672 | "; 673 | } else if ($params['dnssec_records'] == 2) { 674 | $from[] = '/{{ dnssec_data }}/'; 675 | $to[] = " 676 | ".htmlspecialchars($params['keyTag_1'])." 677 | ".htmlspecialchars($params['alg_1'])." 678 | ".htmlspecialchars($params['digestType_1'])." 679 | ".htmlspecialchars($params['digest_1'])." 680 | 681 | 682 | ".htmlspecialchars($params['keyTag_2'])." 683 | ".htmlspecialchars($params['alg_2'])." 684 | ".htmlspecialchars($params['digestType_2'])." 685 | ".htmlspecialchars($params['digest_2'])." 686 | "; 687 | } 688 | $from[] = '/{{ clTRID }}/'; 689 | $clTRID = str_replace('.', '', round(microtime(1), 3)); 690 | $to[] = htmlspecialchars($this->prefix . '-domain-createDNSSEC-' . $clTRID); 691 | $from[] = "/<\w+:\w+>\s*<\/\w+:\w+>\s+/ims"; 692 | $to[] = ''; 693 | $xml = preg_replace($from, $to, ' 694 | 697 | 698 | 699 | 701 | {{ name }} 702 | {{ period }} 703 | 704 | {{ hostAttr }} 705 | 706 | {{ registrant }} 707 | {{ contacts }} 708 | 709 | {{ authInfoPw }} 710 | 711 | 712 | 713 | 714 | 715 | {{ dnssec_data }} 716 | 717 | 718 | {{ clTRID }} 719 | 720 | '); 721 | $r = $this->writeRequest($xml); 722 | $code = (int)$r->response->result->attributes()->code; 723 | $msg = (string)$r->response->result->msg; 724 | $r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->creData; 725 | $name = (string)$r->name; 726 | $crDate = (string)$r->crDate; 727 | $exDate = (string)$r->exDate; 728 | 729 | $return = array( 730 | 'code' => $code, 731 | 'msg' => $msg, 732 | 'name' => $name, 733 | 'crDate' => $crDate, 734 | 'exDate' => $exDate 735 | ); 736 | } catch (\Exception $e) { 737 | $return = array( 738 | 'error' => $e->getMessage() 739 | ); 740 | } 741 | 742 | return $return; 743 | } 744 | 745 | /** 746 | * domainCreateClaims 747 | */ 748 | public function domainCreateClaims($params = array()) 749 | { 750 | if (!$this->isLoggedIn) { 751 | return array( 752 | 'code' => 2002, 753 | 'msg' => 'Command use error' 754 | ); 755 | } 756 | 757 | throw new EppException("Domain create claims is not supported!"); 758 | } 759 | 760 | /** 761 | * domainCreateSunrise 762 | */ 763 | public function domainCreateSunrise($params = array()) 764 | { 765 | if (!$this->isLoggedIn) { 766 | return array( 767 | 'code' => 2002, 768 | 'msg' => 'Command use error' 769 | ); 770 | } 771 | 772 | throw new EppException("Domain create sunrise is not supported!"); 773 | } 774 | 775 | /** 776 | * domainRestore 777 | */ 778 | public function domainRestore($params = array()) 779 | { 780 | if (!$this->isLoggedIn) { 781 | return array( 782 | 'code' => 2002, 783 | 'msg' => 'Command use error' 784 | ); 785 | } 786 | 787 | throw new EppException("Domain restore is not supported!"); 788 | } 789 | 790 | /** 791 | * domainReport 792 | */ 793 | public function domainReport($params = array()) 794 | { 795 | if (!$this->isLoggedIn) { 796 | return array( 797 | 'code' => 2002, 798 | 'msg' => 'Command use error' 799 | ); 800 | } 801 | 802 | throw new EppException("Domain report is not supported!"); 803 | } 804 | 805 | public function _response_log($content) 806 | { 807 | // Add formatted content to the log 808 | $this->responseLogger->info($content); 809 | $this->commonLogger->info($content); 810 | } 811 | 812 | public function _request_log($content) 813 | { 814 | // Add formatted content to the log 815 | $this->requestLogger->info($content); 816 | $this->commonLogger->info($content); 817 | } 818 | 819 | } 820 | -------------------------------------------------------------------------------- /src/Registries/MxEpp.php: -------------------------------------------------------------------------------- 1 | startElement('svcExtension'); 26 | $xml->writeElement('extURI', 'http://www.nic.mx/nicmx-msg-1.0'); 27 | $xml->writeElement('extURI', 'http://www.nic.mx/nicmx-res-1.0'); 28 | $xml->endElement(); // svcExtension 29 | } 30 | 31 | /** 32 | * domainCheckClaims 33 | */ 34 | public function domainCheckClaims($params = array()) 35 | { 36 | if (!$this->isLoggedIn) { 37 | return array( 38 | 'code' => 2002, 39 | 'msg' => 'Command use error' 40 | ); 41 | } 42 | 43 | throw new EppException("Launch extension not supported!"); 44 | } 45 | 46 | /** 47 | * domainCreateClaims 48 | */ 49 | public function domainCreateClaims($params = array()) 50 | { 51 | if (!$this->isLoggedIn) { 52 | return array( 53 | 'code' => 2002, 54 | 'msg' => 'Command use error' 55 | ); 56 | } 57 | 58 | throw new EppException("Launch extension not supported!"); 59 | } 60 | 61 | /** 62 | * domainCreateSunrise 63 | */ 64 | public function domainCreateSunrise($params = array()) 65 | { 66 | if (!$this->isLoggedIn) { 67 | return array( 68 | 'code' => 2002, 69 | 'msg' => 'Command use error' 70 | ); 71 | } 72 | 73 | throw new EppException("Launch extension not supported!"); 74 | } 75 | 76 | public function _response_log($content) 77 | { 78 | // Add formatted content to the log 79 | $this->responseLogger->info($content); 80 | $this->commonLogger->info($content); 81 | } 82 | 83 | public function _request_log($content) 84 | { 85 | // Add formatted content to the log 86 | $this->requestLogger->info($content); 87 | $this->commonLogger->info($content); 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /src/Registries/SeEpp.php: -------------------------------------------------------------------------------- 1 | startElement('svcExtension'); 26 | $xml->writeElement('extURI', 'urn:ietf:params:xml:ns:secDNS-1.1'); 27 | $xml->writeElement('extURI', 'urn:se:iis:xml:epp:iis-1.2'); 28 | $xml->endElement(); // svcExtension 29 | } 30 | 31 | /** 32 | * contactCreate 33 | */ 34 | public function contactCreate($params = array()) 35 | { 36 | if (!$this->isLoggedIn) { 37 | return array( 38 | 'code' => 2002, 39 | 'msg' => 'Command use error' 40 | ); 41 | } 42 | 43 | $return = array(); 44 | try { 45 | $from = $to = array(); 46 | $from[] = '/{{ id }}/'; 47 | $to[] = htmlspecialchars($params['id']); 48 | $from[] = '/{{ name }}/'; 49 | $to[] = htmlspecialchars($params['firstname'] . ' ' . $params['lastname']); 50 | $from[] = '/{{ org }}/'; 51 | $to[] = htmlspecialchars($params['companyname']); 52 | $from[] = '/{{ street1 }}/'; 53 | $to[] = htmlspecialchars($params['address1']); 54 | $from[] = '/{{ street2 }}/'; 55 | $to[] = htmlspecialchars($params['address2']); 56 | $from[] = '/{{ street3 }}/'; 57 | $street3 = (isset($params['address3']) ? $params['address3'] : ''); 58 | $to[] = htmlspecialchars($street3); 59 | $from[] = '/{{ city }}/'; 60 | $to[] = htmlspecialchars($params['city']); 61 | $from[] = '/{{ state }}/'; 62 | $to[] = htmlspecialchars($params['state']); 63 | $from[] = '/{{ postcode }}/'; 64 | $to[] = htmlspecialchars($params['postcode']); 65 | $from[] = '/{{ country }}/'; 66 | $to[] = htmlspecialchars($params['country']); 67 | $from[] = '/{{ phonenumber }}/'; 68 | $to[] = htmlspecialchars($params['fullphonenumber']); 69 | $from[] = '/{{ email }}/'; 70 | $to[] = htmlspecialchars($params['email']); 71 | $from[] = '/{{ clTRID }}/'; 72 | $microtime = str_replace('.', '', round(microtime(1), 3)); 73 | $to[] = htmlspecialchars($this->prefix . '-contact-createIIS-' . $microtime); 74 | $from[] = "/<\w+:\w+>\s*<\/\w+:\w+>\s+/ims"; 75 | $to[] = ''; 76 | $xml = preg_replace($from, $to, ' 77 | 80 | 81 | 82 | 84 | {{ id }} 85 | 86 | {{ name }} 87 | {{ org }} 88 | 89 | {{ street1 }} 90 | {{ street2 }} 91 | {{ street3 }} 92 | {{ city }} 93 | {{ state }} 94 | {{ postcode }} 95 | {{ country }} 96 | 97 | 98 | {{ phonenumber }} 99 | 100 | {{ email }} 101 | 102 | 103 | 104 | 106 | [{{ country }}]{{ orgno }} 107 | {{ vatno }} 108 | 109 | 110 | {{ clTRID }} 111 | 112 | '); 113 | $r = $this->writeRequest($xml); 114 | $code = (int)$r->response->result->attributes()->code; 115 | $msg = (string)$r->response->result->msg; 116 | $r = $r->response->resData->children('urn:ietf:params:xml:ns:contact-1.0')->creData; 117 | $id = (string)$r->id; 118 | 119 | $return = array( 120 | 'code' => $code, 121 | 'msg' => $msg, 122 | 'id' => $id 123 | ); 124 | } catch (\Exception $e) { 125 | $return = array( 126 | 'error' => $e->getMessage() 127 | ); 128 | } 129 | 130 | return $return; 131 | } 132 | 133 | /** 134 | * domainCheckClaims 135 | */ 136 | public function domainCheckClaims($params = array()) 137 | { 138 | if (!$this->isLoggedIn) { 139 | return array( 140 | 'code' => 2002, 141 | 'msg' => 'Command use error' 142 | ); 143 | } 144 | 145 | throw new EppException("Launch extension not supported!"); 146 | } 147 | 148 | /** 149 | * domainInfo 150 | */ 151 | public function domainInfo($params = array()) 152 | { 153 | if (!$this->isLoggedIn) { 154 | return array( 155 | 'code' => 2002, 156 | 'msg' => 'Command use error' 157 | ); 158 | } 159 | 160 | $return = array(); 161 | try { 162 | $from = $to = array(); 163 | $from[] = '/{{ domainname }}/'; 164 | $to[] = htmlspecialchars($params['domainname']); 165 | $from[] = '/{{ clTRID }}/'; 166 | $microtime = str_replace('.', '', round(microtime(1), 3)); 167 | $to[] = htmlspecialchars($this->prefix . '-domain-info-' . $microtime); 168 | $from[] = "/<\w+:\w+>\s*<\/\w+:\w+>\s+/ims"; 169 | $to[] = ''; 170 | $xml = preg_replace($from, $to, ' 171 | 174 | 175 | 176 | 179 | {{ domainname }} 180 | 181 | 182 | {{ clTRID }} 183 | 184 | '); 185 | $r = $this->writeRequest($xml); 186 | $code = (int)$r->response->result->attributes()->code; 187 | $msg = (string)$r->response->result->msg; 188 | $r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->infData; 189 | $name = (string)$r->name; 190 | $roid = (string)$r->roid; 191 | $status = array(); 192 | $i = 0; 193 | foreach ($r->status as $e) { 194 | $i++; 195 | $status[$i] = (string)$e->attributes()->s; 196 | } 197 | $registrant = (string)$r->registrant; 198 | $contact = array(); 199 | $i = 0; 200 | foreach ($r->contact as $e) { 201 | $i++; 202 | $contact[$i]['type'] = (string)$e->attributes()->type; 203 | $contact[$i]['id'] = (string)$e; 204 | } 205 | $ns = array(); 206 | $i = 0; 207 | foreach ($r->ns->hostObj as $hostObj) { 208 | $i++; 209 | $ns[$i] = (string)$hostObj; 210 | } 211 | $host = array(); 212 | $i = 0; 213 | foreach ($r->host as $hostname) { 214 | $i++; 215 | $host[$i] = (string)$hostname; 216 | } 217 | $clID = (string)$r->clID; 218 | $crID = (string)$r->crID; 219 | $crDate = (string)$r->crDate; 220 | $upID = (string)$r->upID; 221 | $upDate = (string)$r->upDate; 222 | $exDate = (string)$r->exDate; 223 | $trDate = (string)$r->trDate; 224 | $authInfo = (string)$r->authInfo->pw; 225 | 226 | $return = array( 227 | 'code' => $code, 228 | 'msg' => $msg, 229 | 'name' => $name, 230 | 'roid' => $roid, 231 | 'status' => $status, 232 | 'registrant' => $registrant, 233 | 'contact' => $contact, 234 | 'ns' => $ns, 235 | 'host' => $host, 236 | 'clID' => $clID, 237 | 'crID' => $crID, 238 | 'crDate' => $crDate, 239 | 'upID' => $upID, 240 | 'upDate' => $upDate, 241 | 'exDate' => $exDate, 242 | 'trDate' => $trDate, 243 | 'authInfo' => $authInfo 244 | ); 245 | } catch (\Exception $e) { 246 | $return = array( 247 | 'error' => $e->getMessage() 248 | ); 249 | } 250 | 251 | return $return; 252 | } 253 | 254 | /** 255 | * domainCreate 256 | */ 257 | public function domainCreate($params = array()) 258 | { 259 | if (!$this->isLoggedIn) { 260 | return array( 261 | 'code' => 2002, 262 | 'msg' => 'Command use error' 263 | ); 264 | } 265 | 266 | $return = array(); 267 | try { 268 | $from = $to = array(); 269 | $from[] = '/{{ name }}/'; 270 | $to[] = htmlspecialchars($params['domainname']); 271 | $from[] = '/{{ period }}/'; 272 | $to[] = (int)($params['period']); 273 | if (isset($params['nss'])) { 274 | $text = ''; 275 | foreach ($params['nss'] as $hostObj) { 276 | $text .= '' . $hostObj . '' . "\n"; 277 | } 278 | $from[] = '/{{ hostObjs }}/'; 279 | $to[] = $text; 280 | } else { 281 | $from[] = '/{{ hostObjs }}/'; 282 | $to[] = ''; 283 | } 284 | $from[] = '/{{ registrant }}/'; 285 | $to[] = htmlspecialchars($params['registrant']); 286 | $from[] = '/{{ contacts }}/'; 287 | $to[] = ''; 288 | $from[] = '/{{ authInfoPw }}/'; 289 | $to[] = htmlspecialchars($params['authInfoPw']); 290 | $from[] = '/{{ clTRID }}/'; 291 | $clTRID = str_replace('.', '', round(microtime(1), 3)); 292 | $to[] = htmlspecialchars($this->prefix . '-domain-create-' . $clTRID); 293 | $from[] = "/<\w+:\w+>\s*<\/\w+:\w+>\s+/ims"; 294 | $to[] = ''; 295 | $xml = preg_replace($from, $to, ' 296 | 299 | 300 | 301 | 303 | {{ name }} 304 | {{ period }} 305 | 306 | {{ hostObjs }} 307 | 308 | {{ registrant }} 309 | {{ contacts }} 310 | 311 | {{ authInfoPw }} 312 | 313 | 314 | 315 | {{ clTRID }} 316 | 317 | '); 318 | $r = $this->writeRequest($xml); 319 | $code = (int)$r->response->result->attributes()->code; 320 | $msg = (string)$r->response->result->msg; 321 | $r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->creData; 322 | $name = (string)$r->name; 323 | $crDate = (string)$r->crDate; 324 | $exDate = (string)$r->exDate; 325 | 326 | $return = array( 327 | 'code' => $code, 328 | 'msg' => $msg, 329 | 'name' => $name, 330 | 'crDate' => $crDate, 331 | 'exDate' => $exDate 332 | ); 333 | } catch (\Exception $e) { 334 | $return = array( 335 | 'error' => $e->getMessage() 336 | ); 337 | } 338 | 339 | return $return; 340 | } 341 | 342 | /** 343 | * domainCreateClaims 344 | */ 345 | public function domainCreateClaims($params = array()) 346 | { 347 | if (!$this->isLoggedIn) { 348 | return array( 349 | 'code' => 2002, 350 | 'msg' => 'Command use error' 351 | ); 352 | } 353 | 354 | throw new EppException("Launch extension not supported!"); 355 | } 356 | 357 | /** 358 | * domainCreateSunrise 359 | */ 360 | public function domainCreateSunrise($params = array()) 361 | { 362 | if (!$this->isLoggedIn) { 363 | return array( 364 | 'code' => 2002, 365 | 'msg' => 'Command use error' 366 | ); 367 | } 368 | 369 | throw new EppException("Launch extension not supported!"); 370 | } 371 | 372 | /** 373 | * domainCreateDNSSEC 374 | */ 375 | public function domainCreateDNSSEC($params = array()) 376 | { 377 | if (!$this->isLoggedIn) { 378 | return array( 379 | 'code' => 2002, 380 | 'msg' => 'Command use error' 381 | ); 382 | } 383 | 384 | $return = array(); 385 | try { 386 | $from = $to = array(); 387 | $from[] = '/{{ name }}/'; 388 | $to[] = htmlspecialchars($params['domainname']); 389 | $from[] = '/{{ period }}/'; 390 | $to[] = (int)($params['period']); 391 | if (isset($params['nss'])) { 392 | $text = ''; 393 | foreach ($params['nss'] as $hostObj) { 394 | $text .= '' . $hostObj . '' . "\n"; 395 | } 396 | $from[] = '/{{ hostObjs }}/'; 397 | $to[] = $text; 398 | } else { 399 | $from[] = '/{{ hostObjs }}/'; 400 | $to[] = ''; 401 | } 402 | $from[] = '/{{ registrant }}/'; 403 | $to[] = htmlspecialchars($params['registrant']); 404 | if ($params['dnssec_records'] == 1) { 405 | $from[] = '/{{ dnssec_data }}/'; 406 | $to[] = " 407 | ".htmlspecialchars($params['keyTag_1'])." 408 | ".htmlspecialchars($params['alg_1'])." 409 | ".htmlspecialchars($params['digestType_1'])." 410 | ".htmlspecialchars($params['digest_1'])." 411 | "; 412 | } else if ($params['dnssec_records'] == 2) { 413 | $from[] = '/{{ dnssec_data }}/'; 414 | $to[] = " 415 | ".htmlspecialchars($params['keyTag_1'])." 416 | ".htmlspecialchars($params['alg_1'])." 417 | ".htmlspecialchars($params['digestType_1'])." 418 | ".htmlspecialchars($params['digest_1'])." 419 | 420 | 421 | ".htmlspecialchars($params['keyTag_2'])." 422 | ".htmlspecialchars($params['alg_2'])." 423 | ".htmlspecialchars($params['digestType_2'])." 424 | ".htmlspecialchars($params['digest_2'])." 425 | "; 426 | } 427 | $from[] = '/{{ authInfoPw }}/'; 428 | $to[] = htmlspecialchars($params['authInfoPw']); 429 | $from[] = '/{{ clTRID }}/'; 430 | $clTRID = str_replace('.', '', round(microtime(1), 3)); 431 | $to[] = htmlspecialchars($this->prefix . '-domain-createDNSSEC-' . $clTRID); 432 | $from[] = "/<\w+:\w+>\s*<\/\w+:\w+>\s+/ims"; 433 | $to[] = ''; 434 | $xml = preg_replace($from, $to, ' 435 | 438 | 439 | 440 | 442 | {{ name }} 443 | {{ period }} 444 | 445 | {{ hostObjs }} 446 | 447 | {{ registrant }} 448 | 449 | {{ authInfoPw }} 450 | 451 | 452 | 453 | 454 | 455 | {{ dnssec_data }} 456 | 457 | 458 | {{ clTRID }} 459 | 460 | '); 461 | $r = $this->writeRequest($xml); 462 | $code = (int)$r->response->result->attributes()->code; 463 | $msg = (string)$r->response->result->msg; 464 | $r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->creData; 465 | $name = (string)$r->name; 466 | $crDate = (string)$r->crDate; 467 | $exDate = (string)$r->exDate; 468 | 469 | $return = array( 470 | 'code' => $code, 471 | 'msg' => $msg, 472 | 'name' => $name, 473 | 'crDate' => $crDate, 474 | 'exDate' => $exDate 475 | ); 476 | } catch (\Exception $e) { 477 | $return = array( 478 | 'error' => $e->getMessage() 479 | ); 480 | } 481 | 482 | return $return; 483 | } 484 | 485 | public function _response_log($content) 486 | { 487 | // Add formatted content to the log 488 | $this->responseLogger->info($content); 489 | $this->commonLogger->info($content); 490 | } 491 | 492 | public function _request_log($content) 493 | { 494 | // Add formatted content to the log 495 | $this->requestLogger->info($content); 496 | $this->commonLogger->info($content); 497 | } 498 | } 499 | --------------------------------------------------------------------------------