Skip to content

Commit

Permalink
Added extension for DNS Belgium (orgext) to delete reseller info from…
Browse files Browse the repository at this point in the history
… a domain name
  • Loading branch information
metaregistrar committed Dec 6, 2022
1 parent cc1f40c commit cf68cf3
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 0 deletions.
38 changes: 38 additions & 0 deletions Examples/deleteresellerdnsbe.php
@@ -0,0 +1,38 @@
<?php
require('../autoloader.php');

use Metaregistrar\EPP\eppConnection;
use Metaregistrar\EPP\eppException;
use Metaregistrar\EPP\eppDomain;

$domainname = 'hartvooredegem.be';
try {
// Please enter your own settings file here under before using this example
if ($conn = eppConnection::create('')) {
$conn->useExtension('orgext-1.0');
// Connect to the EPP server
if ($conn->login()) {
echo "Logged in\n";
removereseller($conn, $domainname);
$conn->logout();
}
}
} catch (eppException $e) {
echo $e->getMessage();
}

function removereseller($conn, $domainname) {
/* @var $conn Metaregistrar\EPP\eppConnection */
try {
$add = new eppDomain($domainname);
$update = new \Metaregistrar\EPP\orgextEppUpdateDomainRequest($domainname,$add);
$update->removeReseller();
echo $update->saveXML();
if ($response = $conn->request($update)) {
/* @var $response Metaregistrar\EPP\eppUpdateDomainResponse */
echo $response->saveXML();
}
} catch (eppException $e) {
echo $e->getMessage() . "\n";
}
}
@@ -0,0 +1,35 @@
<?php
namespace Metaregistrar\EPP;

// See https://docs.dnsbelgium.be/be/epp/updatedomain.html for example request/response

class orgextEppUpdateDomainRequest extends eppUpdateDomainRequest {

function __construct($objectname, $addinfo = null, $removeinfo = null, $updateinfo = null, $forcehostattr=false, $namespacesinroot=true, $usecdata = true) {
parent::__construct($objectname,$addinfo,$removeinfo,$updateinfo,$forcehostattr,$namespacesinroot,$usecdata);
$this->addSessionId();
}
/**
<extension>
<orgext:update xmlns:orgext="urn:ietf:params:xml:ns:epp:orgext-1.0">
<orgext:rem>
<orgext:id role="reseller"/>
</orgext:rem>
</orgext:update>
</extension>
</command>
</epp>
*/
public function removeReseller() {
$this->addExtension('xmlns:orgext', 'urn:ietf:params:xml:ns:epp:orgext-1.0');
$element = $this->createElement('orgext:update');
$remove = $this->createElement('orgext:rem');
$id = $this->createElement('orgext:id');
$id->setAttribute('role','reseller');
$remove->appendChild($id);
$element->appendChild($remove);
$this->getExtension()->appendChild($element);
$this->addSessionId();
}

}
5 changes: 5 additions & 0 deletions Protocols/EPP/eppExtensions/orgext-1.0/includes.php
@@ -0,0 +1,5 @@
<?php
$this->addExtension('orgext', 'urn:ietf:params:xml:ns:epp:orgext-1.0');

include_once(dirname(__FILE__) . '/eppRequests/orgextEppUpdateDomainRequest.php');
$this->addCommandResponse('Metaregistrar\EPP\orgextEppUpdateDomainRequest', 'Metaregistrar\EPP\eppUpdateDomainResponse');

0 comments on commit cf68cf3

Please sign in to comment.