Beispiel #1
0
 private static function setupConnection()
 {
     try {
         $conn = new Metaregistrar\EPP\metaregEppConnection();
         if ($conn->setConnectionDetails(dirname(__FILE__) . '/testsetup.ini')) {
             if ($conn->login()) {
                 return $conn;
             }
         }
     } catch (Metaregistrar\EPP\eppException $e) {
         echo "Test setup error in " . $e->getClass() . ": " . $e->getMessage() . "\n\n";
         die;
     }
     return null;
 }
 public function testCommandWithoutLogin()
 {
     $conn = new Metaregistrar\EPP\metaregEppConnection(false);
     $conn->setHostname('ssl://epp.test2.metaregistrar.com');
     $conn->setPort(7443);
     if ($conn->connect()) {
         $domain = new Metaregistrar\EPP\eppDomain('fasfasfasfashfgaf.guru');
         $info = new Metaregistrar\EPP\eppInfoDomainRequest($domain);
         $response = $conn->writeandread($info);
         $this->assertInstanceOf('Metaregistrar\\EPP\\eppInfoResponse', $response);
         if ($response instanceof Metaregistrar\EPP\eppInfoResponse) {
             $this->setExpectedException('Metaregistrar\\epp\\eppException', 'Error 2202: Invalid authorization information');
             $this->assertFalse($response->Success());
         }
     }
 }
 private static function setupConnection($configfile)
 {
     try {
         if ($conn = Metaregistrar\EPP\metaregEppConnection::create($configfile)) {
             /* @var $conn Metaregistrar\EPP\eppConnection */
             //$conn->enableRgp();
             if ($conn->login()) {
                 return $conn;
             }
         }
     } catch (Metaregistrar\EPP\eppException $e) {
         echo "Test setup error in " . $e->getClass() . ": " . $e->getMessage() . "\n\n";
         die;
     }
     return null;
 }
/*
 * This script checks for the availability of domain names in a certain launchphase
 *
 * You can specify multiple domain names to be checked
 */
if ($argc <= 1) {
    echo "Usage: checklaunchdomain.php <domainnames>\n";
    echo "Please enter one or more domain names to check\n\n";
    die;
}
for ($i = 1; $i < $argc; $i++) {
    $domains[] = $argv[$i];
}
echo "Checking " . count($domains) . " domain names\n";
try {
    $conn = new Metaregistrar\EPP\metaregEppConnection(true);
    $conn->enableLaunchphase('claims');
    // Connect to the EPP server
    if ($conn->connect()) {
        if (login($conn)) {
            checkdomains($conn, $domains);
            logout($conn);
        }
    } else {
        echo "ERROR CONNECTING\n";
    }
} catch (Metaregistrar\EPP\eppException $e) {
    echo "ERROR: " . $e->getMessage() . "\n\n";
}
/**
 * @param $conn Metaregistrar\EPP\eppConnection
Beispiel #5
0
<?php

require '../autoloader.php';
/*
 * This script checks for the availability of domain names
 *
 * You can specify multiple domain names to be checked
 */
if ($argc <= 1) {
    echo "Usage: infodomain.php <domainname>\n";
    echo "Please enter a domain name retrieve\n\n";
    die;
}
echo "Retrieving info on " . $domainname . "\n";
try {
    $conn = new Metaregistrar\EPP\metaregEppConnection();
    $conn->setConnectionDetails('');
    // Connect to the EPP server
    if ($conn->login()) {
        $result = infodomain($conn, $domainname);
        $conn->logout();
    }
} catch (Metaregistrar\EPP\eppException $e) {
    echo "ERROR: " . $e->getMessage() . "\n\n";
}
/**
 * @param $conn Metaregistrar\EPP\eppConnection
 * @param $domainname string
 * @return string
 */
function infodomain($conn, $domainname)
/*
 * This script checks for the availability of domain names in a certain launchphase
 *
 * You can specify multiple domain names to be checked
 */
if ($argc <= 1) {
    echo "Usage: checklaunchdomain.php <domainnames>\n";
    echo "Please enter one or more domain names to check\n\n";
    die;
}
for ($i = 1; $i < $argc; $i++) {
    $domains[] = $argv[$i];
}
echo "Checking " . count($domains) . " domain names\n";
try {
    $conn = new Metaregistrar\EPP\metaregEppConnection();
    $conn->setConnectionDetails('');
    $conn->enableLaunchphase('claims');
    // Connect and login to the EPP server
    if ($conn->login()) {
        checkdomains($conn, $domains);
        $conn->logout();
    }
} catch (Metaregistrar\EPP\eppException $e) {
    echo "ERROR: " . $e->getMessage() . "\n\n";
}
/**
 * @param $conn Metaregistrar\EPP\eppConnection
 * @param $domains array
 */
function checkdomains($conn, $domains)
<?php

require '../autoloader.php';
/*
 * This script polls for new messages in the EPP system
 * The messages tell you if a domain name was transferred away to another provider
 * Or it tells you that your credit balance is low
 * Please use the pollack function to acknowledge a message and remove it from the queue
 */
$domainname = 'test.org';
try {
    echo "Polling for messages\n";
    $conn = new Metaregistrar\EPP\metaregEppConnection();
    $conn->setConnectionDetails('');
    // Connect to the EPP server
    if ($conn->login()) {
        $messageid = poll($conn);
        if ($messageid) {
            transferconfirm($conn, $domainname);
            pollack($conn, $messageid);
        }
        $conn->logout();
    }
} catch (Metaregistrar\EPP\eppException $e) {
    echo "ERROR: " . $e->getMessage() . "\n\n";
}
/**
 * @param $conn Metaregistrar\EPP\eppConnection
 * @return null
 */
function poll($conn)
Beispiel #8
0
require '../autoloader.php';
/*
 * This script checks for the availability of domain names
 * You can specify multiple domain names to be checked
 */
if ($argc <= 1) {
    echo "Usage: checkdomain.php <domainnames>\n";
    echo "Please enter one or more domain names to check\n\n";
    die;
}
for ($i = 1; $i < $argc; $i++) {
    $domains[] = $argv[$i];
}
echo "Checking " . count($domains) . " domain names\n";
try {
    $conn = new Metaregistrar\EPP\metaregEppConnection(true);
    // Set login details for the service in the form of
    // interface=metaregEppConnection
    // hostname=ssl://epp.test2.metaregistrar.com
    // port=7443
    // userid=xxxxxxxx
    // password=xxxxxxxxx
    $conn->setConnectionDetails('');
    // Connect and login to the EPP server
    if ($conn->login()) {
        // Check domain names
        checkdomains($conn, $domains);
        $conn->logout();
    }
} catch (Metaregistrar\EPP\eppException $e) {
    echo "ERROR: " . $e->getMessage() . "\n\n";
Beispiel #9
0
<?php

require '../autoloader.php';
/*
 * This script checks for the availability of domain names
 *
 * You can specify multiple domain names to be checked
 */
if ($argc <= 1) {
    echo "Usage: changepassword <password>\n";
    echo "Please enter new password you want to use\n\n";
    die;
}
$newpassword = $argv[1];
echo "Changing password\n";
try {
    $conn = new Metaregistrar\EPP\metaregEppConnection();
    $conn->setConnectionDetails('');
    $conn->setNewPassword($newpassword);
    // Connect and login to the EPP server
    if ($conn->login()) {
        echo "Password was changed, you are logged-out automatically\n";
    }
} catch (Metaregistrar\EPP\eppException $e) {
    echo "ERROR: " . $e->getMessage() . "\n\n";
}
<?php

require '../autoloader.php';
/*
 * This script checks for the availability of domain names
 *
 * You can specify multiple domain names to be checked
 */
if ($argc <= 1) {
    echo "Usage: changepassword <password>\n";
    echo "Please enter new password you want to use\n\n";
    die;
}
$newpassword = $argv[1];
echo "Changing password\n";
try {
    $conn = new Metaregistrar\EPP\metaregEppConnection();
    $conn->setNewPassword($newpassword);
    // Connect to the EPP server
    if ($conn->connect()) {
        if (login($conn)) {
            echo "Password was changed, you are logged-out automatically\n";
        }
    }
} catch (Metaregistrar\EPP\eppException $e) {
    echo "ERROR: " . $e->getMessage() . "\n\n";
}
<?php

require '../autoloader.php';
/*
 * This sample script registers a domain name within your account
 * 
 * The nameservers of metaregistrar are used as nameservers
 * In this scrips, the same contact id is used for registrant, admin-contact, tech-contact and billing contact
 * Recommended usage is that you use a tech-contact and billing contact of your own, and set registrant and admin-contact to the domain name owner or reseller.
 */
$now = $current_date = gmDate("Y-m-d\\TH:i:s\\Z");
$claims = array('test-claims-1.frl' => array('noticeid' => '2a87fdbb9223372036854775807', 'notafter' => '2019-09-04T07:47:03.123Z', 'lookup' => '2013041500/2/6/9/rJ1NrDO92vDsAzf7EQzgjX4R2127', 'confirmed' => $now), 'test-claims-2.frl' => array('noticeid' => 'e434f0f59223372036854775807', 'notafter' => '2018-10-01T15:40:13.843Z', 'lookup' => '2013041500/2/6/9/rJ1NrDO92vDsAzf7EQzgjX4R2609', 'confirmed' => $now), 'test-claims-3.frl' => array('noticeid' => '3d2f541d9223372036854775807', 'notafter' => '2018-11-06T08:17:08.8Z', 'lookup' => '2013041500/2/6/9/rJ1NrDO92vDsAzf7EQzgjX3R2333', 'confirmed' => $now), 'a-b-c-d-e-fg.amsterdam' => array('noticeid' => '27d5501a0000000000000407286', 'notafter' => '2015-05-30T00:00:00.0Z', 'lookup' => '2015052800/9/6/9/lpexfNxa2c0WNTKtzWXsizak0000000408', 'confirmed' => $now), 'a-b-c-d-ef-g.amsterdam' => array('noticeid' => 'f9378df20000000000000407484', 'notafter' => '2015-05-30T00:00:00.0Z', 'lookup' => '2015052800/8/F/1/jxDmzfePmZekFgnG9dI8F0zG0000000606', 'confirmed' => $now));
$domainname = '';
try {
    $conn = new Metaregistrar\EPP\metaregEppConnection();
    $conn->setConnectionDetails('');
    $conn->enableLaunchphase('claims');
    // Connect and login to the EPP server
    if ($conn->login()) {
        $contactid = '';
        $techcontact = $contactid;
        $billingcontact = $contactid;
        $nameservers = array('ns1.metaregistrar.nl', 'ns2.metaregistrar.nl');
        echo "Registering {$domainname}\n";
        $claim = checkdomainclaim($conn, $domainname);
        if ($claim) {
            createclaimeddomain($conn, $domainname, $claim, $contactid, $contactid, $techcontact, $billingcontact, $nameservers);
        } else {
            createdomain($conn, $domainname, $contactid, $contactid, $techcontact, $billingcontact, $nameservers);
        }
        $conn->logout();
Beispiel #12
0
<?php

require '../autoloader.php';
try {
    $conn = new Metaregistrar\EPP\metaregEppConnection();
    // Connect to the EPP server
    if ($conn->connect()) {
        if (login($conn)) {
            echo "Creating contact\n";
            $contactid = createcontact($conn, '*****@*****.**', '+31.61234567890', 'Person name', null, 'Address 1', '12345', 'City', 'NL');
            echo "Updating {$contactid}\n";
            updatecontact($conn, $contactid, '*****@*****.**', '+31.20123456789', 'Updates name', 'Updated org', 'Updated address 1', '12345', 'City', 'NL');
            logout($conn);
        }
    }
} catch (Metaregistrar\EPP\eppException $e) {
    echo $e->getMessage() . "\n";
    logout($conn);
}
function updatecontact($conn, $contactid, $email, $telephone, $name, $organization, $address, $postcode, $city, $country)
{
    /* @var $conn Metaregistrar\EPP\eppConnection.php */
    try {
        $contact = new Metaregistrar\EPP\eppContactHandle($contactid);
        $update = new Metaregistrar\EPP\eppContact();
        $update->setVoice($telephone);
        $update->setEmail($email);
        $pi = new Metaregistrar\EPP\eppContactPostalInfo($name, $city, $country, $organization, $address, null, $postcode, Metaregistrar\EPP\eppContact::TYPE_LOC);
        $update->addPostalInfo($pi);
        $up = new Metaregistrar\EPP\eppUpdateContactRequest($contact, null, null, $update);
        if (($response = $conn->writeandread($up)) instanceof Metaregistrar\EPP\eppUpdateResponse && $response->Success()) {
Beispiel #13
0
<?php

require '../autoloader.php';
try {
    $domainname = 'dnssectest.nl';
    $conn = new Metaregistrar\EPP\metaregEppConnection();
    $conn->setConnectionDetails('');
    $conn->enableDnssec();
    if ($conn->login()) {
        $add = new Metaregistrar\EPP\eppDomain($domainname);
        $sec = new Metaregistrar\EPP\eppSecdns();
        $sec->setKey('256', '8', 'AwEAAbWM8nWQZbDZgJjyq+tLZwPLEXfZZjfvlRcmoAVZHgZJCPn/Ytu/iOsgci+yWgDT28ENzREAoAbKMflFFdhc5DNV27TZxhv8nMo9n2f+cyyRKbQ6oIAvMl7siT6WxrLxEBIMyoyFgDMbqGScn9k19Ppa8fwnpJgv0VUemfxGqHH9');
        $add->addSecdns($sec);
        $domain = new Metaregistrar\EPP\eppDnssecUpdateDomainRequest($domainname, $add);
        if (($response = $conn->writeandread($domain)) instanceof Metaregistrar\EPP\eppUpdateResponse && $response->Success()) {
            echo "OKAY\n";
        }
        $conn->logout();
    }
    return true;
} catch (Metaregistrar\EPP\eppException $e) {
    echo "ERROR: " . $e->getMessage() . "\n";
}
Beispiel #14
0
require '../autoloader.php';
/*
 * This sample script registers a domain name within your account
 * 
 * The nameservers of metaregistrar are used as nameservers
 * In this scrips, the same contact id is used for registrant, admin-contact, tech-contact and billing contact
 * Recommended usage is that you use a tech-contact and billing contact of your own, and set registrant and admin-contact to the domain name owner or reseller.
 */
if ($argc <= 1) {
    echo "Usage: registerdomain.php <domainname>\n";
    echo "Please enter the domain name to be created\n\n";
    die;
}
$domainname = $argv[1];
echo "Registering {$domainname}\n";
$conn = new Metaregistrar\EPP\metaregEppConnection();
$conn->setConnectionDetails('');
// Connect to the EPP server
if ($conn->login()) {
    //if (!checkhosts($conn, array('ns1.metaregistrar.nl'))) {
    //    createhost($conn, 'ns1.metaregistrar.nl');
    //}
    //if (!checkhosts($conn, array('ns5.metaregistrar.nl'))) {
    //    createhost($conn, 'ns2.metaregistrar.nl');
    //}
    //$nameservers = array('ns1.metaregistrar.nl','ns2.metaregistrar.nl');
    //$contactid = createcontact($conn,'*****@*****.**','+31.61234567890','Person name',null,'Address 1','12345','City','NL');
    $nameservers = null;
    $contactid = 'PAU000001-MIJND';
    if ($contactid) {
        createdomain($conn, $domainname, $contactid, $contactid, $contactid, $contactid, $nameservers);
Beispiel #15
0
<?php

require '../autoloader.php';
try {
    $conn = new Metaregistrar\EPP\metaregEppConnection();
    $conn->setConnectionDetails('');
    // Connect to the EPP server
    if ($conn->login()) {
        createcontact($conn, '*****@*****.**', '+31.201234567', 'Domain Administration', 'Metaregistrar', 'Address 1', 'Zipcode', 'City', 'NL');
        $conn->logout();
    }
} catch (Metaregistrar\EPP\eppException $e) {
    echo "ERROR: " . $e->getMessage() . "\n\n";
}
/**
 * @param $conn Metaregistrar\EPP\eppConnection
 * @param $email string
 * @param $telephone string
 * @param $name string
 * @param $organization string
 * @param $address string
 * @param $postcode string
 * @param $city string
 * @param $country string
 * @return null
 */
function createcontact($conn, $email, $telephone, $name, $organization, $address, $postcode, $city, $country)
{
    $postalinfo = new Metaregistrar\EPP\eppContactPostalInfo($name, $city, $country, $organization, $address, null, $postcode);
    $contactinfo = new Metaregistrar\EPP\eppContact($postalinfo, $email, $telephone);
    $contactinfo->setPassword('');
Beispiel #16
0
<?php

require '../autoloader.php';
try {
    $conn = new Metaregistrar\EPP\metaregEppConnection();
    $conn->setConnectionDetails('');
    // Connect to the EPP server
    if ($conn->login()) {
        echo "Creating contact\n";
        $contactid = createcontact($conn, '*****@*****.**', '+31.61234567890', 'Person name', null, 'Address 1', '12345', 'City', 'NL');
        echo "Updating {$contactid}\n";
        updatecontact($conn, $contactid, '*****@*****.**', '+31.20123456789', 'Updates name', 'Updated org', 'Updated address 1', '12345', 'City', 'NL');
        $conn->logout();
    }
} catch (Metaregistrar\EPP\eppException $e) {
    echo $e->getMessage() . "\n";
}
function updatecontact($conn, $contactid, $email, $telephone, $name, $organization, $address, $postcode, $city, $country)
{
    /* @var $conn Metaregistrar\EPP\eppConnection.php */
    try {
        $contact = new Metaregistrar\EPP\eppContactHandle($contactid);
        $update = new Metaregistrar\EPP\eppContact();
        $update->setVoice($telephone);
        $update->setEmail($email);
        $pi = new Metaregistrar\EPP\eppContactPostalInfo($name, $city, $country, $organization, $address, null, $postcode, Metaregistrar\EPP\eppContact::TYPE_LOC);
        $update->addPostalInfo($pi);
        $up = new Metaregistrar\EPP\eppUpdateContactRequest($contact, null, null, $update);
        if (($response = $conn->writeandread($up)) instanceof Metaregistrar\EPP\eppUpdateResponse && $response->Success()) {
            /* @var $response Metaregistrar\EPP\eppCreateResponse */
            echo "Contact {$contactid} updated, infoing\n";
Beispiel #17
0
/*
 * This sample script modifies a domain name within your account
 * 
 * The nameservers of metaregistrar are used as nameservers
 * In this scrips, the same contact id is used for registrant, admin-contact, tech-contact and billing contact
 * Recommended usage is that you use a tech-contact and billing contact of your own, and set registrant and admin-contact to the domain name owner or reseller.
 */
if ($argc <= 1) {
    echo "Usage: modifydomain.php <domainname>\n";
    echo "Please enter the domain name to be modified\n\n";
    die;
}
$domainname = $argv[1];
echo "Modifying {$domainname}\n";
try {
    $conn = new Metaregistrar\EPP\metaregEppConnection();
    $conn->setConnectionDetails('');
    // Connect to the EPP server
    if ($conn->login()) {
        modifydomain($conn, $domainname, null, null, null, null, array('ns1.metaregistrar.nl', 'ns2.metaregistrar.nl'));
        $conn->logout();
    }
} catch (Metaregistrar\EPP\eppException $e) {
    echo $e->getMessage() . "\n";
    logout($conn);
}
/**
 * @param $conn Metaregistrar\EPP\eppConnection
 * @param $domainname string
 * @param null $registrant string
 * @param null $admincontact string
Beispiel #18
0
<?php

require '../autoloader.php';
/*
 * This script requests a domain name transfer into your account
 */
if ($argc <= 2) {
    echo "Usage: transferdomain.php <domainname> <authcode>\n";
    echo "Please the domain name and the auth code for transfer\n\n";
    die;
}
$domainname = $argv[1];
$authcode = $argv[2];
echo "Transferring {$domainname}\n";
try {
    $conn = new Metaregistrar\EPP\metaregEppConnection();
    $conn->setConnectionDetails('');
    // Connect and login to the EPP server
    if ($conn->login()) {
        transferdomain($conn, $domainname, $authcode);
        $conn->logout();
    }
} catch (Metaregistrar\EPP\eppException $e) {
    echo "ERROR: " . $e->getMessage() . "\n\n";
}
/**
 * @param $conn Metaregistrar\EPP\eppConnection
 * @param $domainname string
 * @param $authcode string
 */
function transferdomain($conn, $domainname, $authcode)
/*
 * This sample script registers a domain name within your account
 * 
 * The nameservers of metaregistrar are used as nameservers
 * In this scrips, the same contact id is used for registrant, admin-contact, tech-contact and billing contact
 * Recommended usage is that you use a tech-contact and billing contact of your own, and set registrant and admin-contact to the domain name owner or reseller.
 */
if ($argc <= 1) {
    echo "Usage: createlaunchdomain.php <domainname>\n";
    echo "Please enter the domain name to be created\n\n";
    die;
}
$domainname = $argv[1];
echo "Registering {$domainname}\n";
try {
    $conn = new Metaregistrar\EPP\metaregEppConnection();
    $conn->setConnectionDetails('');
    // Connect to the EPP server
    if ($conn->login()) {
        $contactid = 'mrg54b6560e01ddf';
        $techcontact = $contactid;
        $billingcontact = $contactid;
        if ($contactid) {
            createdomain($conn, $domainname, $contactid, $contactid, $techcontact, $billingcontact, array('ns1.metaregistrar.nl', 'ns2.metaregistrar.nl'));
        }
        $conn->logout();
    }
} catch (Metaregistrar\EPP\eppException $e) {
    echo "ERROR: " . $e->getMessage() . "\n\n";
}
/**