/** * @param eppConnection $conn * @param string $domainname * @param string $authcode */ function transferdomain($conn, $domainname, $authcode) { try { $domain = new eppDomain($domainname); $domain->setAuthorisationCode($authcode); $transfer = new eppTransferRequest(eppTransferRequest::OPERATION_REQUEST, $domain); if ($response = $conn->request($transfer)) { /* @var $response Metaregistrar\EPP\eppTransferResponse */ echo $response->getDomainName(), " transfer request was succesful\n"; } } catch (eppException $e) { echo $e->getMessage() . "\n"; } }
/** * @param eppConnection $conn * @param string $email * @param string $telephone * @param string $name * @param string $organization * @param string $address * @param string $postcode * @param string $city * @param string $country * @return null|string */ function createcontact($conn, $email, $telephone, $name, $organization, $address, $postcode, $city, $country) { try { $contact = new Metaregistrar\EPP\eppContact(new Metaregistrar\EPP\eppContactPostalInfo($name, $city, $country, $organization, $address, null, $postcode, Metaregistrar\EPP\eppContact::TYPE_LOC), $email, $telephone); $create = new Metaregistrar\EPP\EppCreateContactRequest($contact); if ($response = $conn->request($create)) { /* @var $response Metaregistrar\EPP\eppCreateContactResponse */ echo "Contact created on " . $response->getContactCreateDate() . " with id " . $response->getContactId() . "\n"; return $response->getContactId(); } } catch (Metaregistrar\EPP\eppException $e) { echo $e->getMessage() . "\n"; } return null; }
/** * @param eppConnection $conn * @return null */ function poll($conn) { try { $poll = new eppPollRequest(eppPollRequest::POLL_REQ, 0); if ($response = $conn->request($poll)) { /* @var $response Metaregistrar\EPP\eppPollResponse */ if ($response->getResultCode() == eppResponse::RESULT_MESSAGE_ACK) { //echo $response->saveXML(); echo $response->getMessageCount() . " messages waiting in the queue\n"; echo "Picked up message " . $response->getMessageId() . ': ' . $response->getMessage() . "\n"; return $response->getMessageId(); } else { echo $response->getResultMessage() . "\n"; } } } catch (eppException $e) { echo $e->getMessage() . "\n"; } return null; }
<?php require '../autoloader.php'; use Metaregistrar\EPP\eppConnection; use Metaregistrar\EPP\eppDomain; use Metaregistrar\EPP\eppSecdns; use Metaregistrar\EPP\eppDnssecUpdateDomainRequest; use Metaregistrar\EPP\eppException; try { $domainname = 'dnssectest.nl'; // Please enter your own settings file here under before using this example if ($conn = eppConnection::create('')) { $conn->enableDnssec(); if ($conn->login()) { $add = new eppDomain($domainname); $sec = new eppSecdns(); $sec->setKey('256', '8', 'AwEAAbWM8nWQZbDZgJjyq+tLZwPLEXfZZjfvlRcmoAVZHgZJCPn/Ytu/iOsgci+yWgDT28ENzREAoAbKMflFFdhc5DNV27TZxhv8nMo9n2f+cyyRKbQ6oIAvMl7siT6WxrLxEBIMyoyFgDMbqGScn9k19Ppa8fwnpJgv0VUemfxGqHH9'); $add->addSecdns($sec); $update = new eppDnssecUpdateDomainRequest($domainname, $add); if ($response = $conn->request($update)) { /* @var $response Metaregistrar\EPP\eppUpdateDomainResponse */ echo "DNSSEC updated\n"; } $conn->logout(); } } } catch (eppException $e) { echo "ERROR: " . $e->getMessage() . "\n"; }
/** * @param eppConnection $conn * @param string $domainname * @param string $registrant * @param string $admincontact * @param string $techcontact * @param string $billingcontact * @param array $nameservers * @throws eppException */ function createdomain($conn, $domainname, $registrant, $admincontact, $techcontact, $billingcontact, $nameservers) { $domain = new eppDomain($domainname, $registrant); $reg = new eppContactHandle($registrant); $domain->setRegistrant($reg); $admin = new eppContactHandle($admincontact, eppContactHandle::CONTACT_TYPE_ADMIN); $domain->addContact($admin); $tech = new eppContactHandle($techcontact, eppContactHandle::CONTACT_TYPE_TECH); $domain->addContact($tech); $billing = new eppContactHandle($billingcontact, eppContactHandle::CONTACT_TYPE_BILLING); $domain->addContact($billing); $domain->setAuthorisationCode($domain->generateRandomString(8)); if (is_array($nameservers)) { foreach ($nameservers as $nameserver) { $host = new eppHost($nameserver); $domain->addHost($host); } } $create = new eppCreateDomainRequest($domain); if ($response = $conn->request($create)) { /* @var $response Metaregistrar\EPP\eppCreateResponse */ echo "Domain " . $response->getDomainName() . " created on " . $response->getDomainCreateDate() . ", expiration date is " . $response->getDomainExpirationDate() . "\n"; } }
use Metaregistrar\EPP\ptEppInfoDomainRequest; use Metaregistrar\EPP\eppContactHandle; use Metaregistrar\EPP\eppHost; /* * This script retrieves all information for a specific domain name */ if ($argc <= 1) { echo "Usage: infodomain.php <domainname>\n"; echo "Please enter a domain name retrieve\n\n"; die; } $domainname = $argv[1]; echo "Retrieving info on " . $domainname . "\n"; try { // Please enter your own settings file here under before using this example if ($conn = eppConnection::create('pt.ini', true)) { // Connect to the EPP server if ($conn->login()) { $roid = '12345'; $result = infodomain($conn, $domainname, $roid); $conn->logout(); } } } catch (Metaregistrar\EPP\eppException $e) { echo "ERROR: " . $e->getMessage() . "\n\n"; } /** * @param $conn Metaregistrar\EPP\eppConnection * @param $domainname string * @return string */
/** * @param eppConnection $conn * @param string $domainname * @param string $registrant * @param string $admincontact * @param string $techcontact * @param string $billingcontact * @param array $nameservers */ function createdomain($conn, $domainname, $registrant, $admincontact, $techcontact, $billingcontact, $nameservers) { /* @var $conn Metaregistrar\EPP\eppConnection */ try { $domain = new eppDomain($domainname, $registrant); $domain->setRegistrant(new eppContactHandle($registrant)); $domain->addContact(new eppContactHandle($admincontact, eppContactHandle::CONTACT_TYPE_ADMIN)); $domain->addContact(new eppContactHandle($techcontact, eppContactHandle::CONTACT_TYPE_TECH)); $domain->addContact(new eppContactHandle($billingcontact, eppContactHandle::CONTACT_TYPE_BILLING)); $domain->setAuthorisationCode('rand0m'); if (is_array($nameservers)) { foreach ($nameservers as $nameserver) { $domain->addHost(new eppHost($nameserver)); } } $create = new eppCreateDomainRequest($domain); if ($response = $conn->request($create)) { /* @var $response Metaregistrar\EPP\eppCreateDomainResponse */ echo "Domain " . $response->getDomainName() . " created on " . $response->getDomainCreateDate() . ", expiration date is " . $response->getDomainExpirationDate() . "\n"; } } catch (eppException $e) { echo $e->getMessage() . "\n"; } }
/** * @param \Metaregistrar\EPP\eppConnection $conn * @param string $contactid */ function infocontact($conn, $contactid) { try { $contact = new Metaregistrar\EPP\eppContactHandle($contactid); $info = new Metaregistrar\EPP\eppInfoContactRequest($contact); if (($response = $conn->writeandread($info)) instanceof Metaregistrar\EPP\eppInfoContactResponse && $response->Success()) { echo $response->saveXML(); } } catch (Metaregistrar\EPP\eppException $e) { echo $e->getMessage() . "\n"; } }