Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ## Tool to update registrar contact details (details sent in update emails etc)
- ## Everything Web CC - Used AllWorldIT's sync script and modified to suit
- ## Edit this file with the new details you'd like
- ## Format must be as per the RAR guidelines @ https://www.registry.net.za/content.php?wiki=1&contentid=28&title=Contact%20Constraints
- $new_details = array(
- 'name' => 'Domain Administrator',
- 'city' => 'Cape Town',
- 'country_code' => 'ZA',
- 'telephone' => '+27.123456789',
- 'fax' => '+27.123456789',
- );
- # This file brings in a few constants we need
- require_once dirname(__FILE__) . '/../../../dbconnect.php';
- # Setup include dir
- $include_path = ROOTDIR . '/modules/registrars/cozaepp';
- set_include_path($include_path . PATH_SEPARATOR . get_include_path());
- # Include EPP stuff we need
- require_once 'cozaepp.php';
- # Additional functions we need
- require_once ROOTDIR . '/includes/functions.php';
- # Include registrar functions aswell
- require_once ROOTDIR . '/includes/registrarfunctions.php';
- # We need pear for the error handling
- require_once "PEAR.php";
- # Grab module parameters
- $params = getregistrarconfigoptions('cozaepp');
- echo("COZA-EPP Update Registrar Contact Details\n");
- echo("------------------------------------------\n");
- # Request balance from registrar
- if (PEAR::isError($client = _cozaepp_Client())) {
- echo("ERROR: ".$client->getMessage()."\n");
- exit;
- }
- $xml = '<epp:epp xmlns:epp="urn:ietf:params:xml:ns:epp-1.0" xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
- <epp:command>
- <epp:update>
- <contact:update>
- <contact:id>'.$params['Username'].'</contact:id>
- <contact:chg>
- <contact:postalInfo type="loc">
- <contact:name>'.$new_details['name'].'</contact:name>
- <contact:addr>
- <contact:city>'.$new_details['city'].'</contact:city>
- <contact:cc>'.$new_details['country_code'].'</contact:cc>
- </contact:addr>
- </contact:postalInfo>
- <contact:voice>'.$new_details['telephone'].'</contact:voice>
- <contact:fax>'.$new_details['fax'].'</contact:fax>
- <contact:email>'.$new_details['email'].'</contact:email>
- </contact:chg>
- </contact:update>
- </epp:update>
- </epp:command>
- </epp:epp>';
- # Query domain
- $output = $client->request($xml);
- $doc= new DOMDocument();
- $doc->loadXML($output);
- $coderes = $doc->getElementsByTagName('result')->item(0)->getAttribute('code');
- if ($coderes == '1000') {
- if($doc->getElementsByTagName('msg')) {
- if($doc->getElementsByTagName('msg')->item(0)) {
- echo "- Results: ".$doc->getElementsByTagName('msg')->item(0)->nodeValue."\n";
- } else {
- echo "There was an error! - ".print_r($doc)."\n";
- }
- }
- } else {
- echo "Contact Update Error: "._cozaepp_message($coderes)." - ".print_r($doc)."\n";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment