Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added extension for DNS Belgium (orgext) to delete reseller info from…
… a domain name
- Loading branch information
1 parent
cc1f40c
commit cf68cf3
Showing
3 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
Protocols/EPP/eppExtensions/orgext-1.0/eppRequests/orgextEppUpdateDomainRequest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'); |