示例#1
0
 */
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();
// Connect to the EPP server
if ($conn->connect()) {
    if (login($conn)) {
        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');
        if ($contactid) {
            createdomain($conn, $domainname, $contactid, $contactid, $contactid, $contactid, $nameservers);
        }
        logout($conn);
    }
}
function checkcontact($conn, $contactid)
{
    /* @var $conn Metaregistrar\EPP\eppConnection */
    try {
        $contactinfo = new Metaregistrar\EPP\eppContactHandle($contactid);
    $hosts[] = $argv[$i];
}
echo "Checking " . count($hosts) . " host names\n";
try {
    // Set login details for the service in the form of
    // interface=metaregEppConnection
    // hostname=ssl://epp.test2.metaregistrar.com
    // port=7443
    // userid=xxxxxxxx
    // password=xxxxxxxxx
    // Please enter the location of the file with these settings in the string location here under
    if ($conn = eppConnection::create('')) {
        // Connect and login to the EPP server
        if ($conn->login()) {
            // Check domain names
            checkhosts($conn, $hosts);
            $conn->logout();
        }
    }
} catch (eppException $e) {
    echo "ERROR: " . $e->getMessage() . "\n\n";
}
/**
 * @param $conn Metaregistrar\EPP\eppConnection
 * @param $hosts array of hostnames
 */
function checkhosts($conn, $hosts)
{
    // Create request to be sent to EPP service
    $check = new eppCheckHostRequest($hosts);
    // Write request to EPP service, read and check the results
示例#3
0
$domains = ['ewoutdegraaf.fi'];
try {
    if ($conn = eppConnection::create('settings.ini', false)) {
        // Connect and login to the EPP server
        if ($conn->login()) {
            echo "Checking balance\n";
            checkbalance($conn);
            echo "Checking poll\n";
            checkpoll($conn);
            // Check domain names
            echo "Checking " . count($domains) . " domain names\n";
            checkdomains($conn, $domains);
            echo "Checking contact\n";
            checkcontact($conn, 'C5525');
            echo "Checking hosts\n";
            checkhosts($conn, ['ns1.metaregistrar.com', 'ns2.metaregistrar.com', 'ns3.metaregistrar.com']);
            //echo "Creating contact\n";
            //$contactid = createcontact($conn, '*****@*****.**','+35.8401231234','Department' ,'Metaregistrar' ,'Zuidelijk Halfrond 1' ,'8201 DD' , 'Gouda', 'NL');
            $registrant = 'C5525';
            $admin = 'C2526';
            $tech = 'C4529';
            echo "Creating domain\n";
            createdomain($conn, 'ewoutdegraaf4.fi', $registrant, $admin, $tech, null, ['ns1.metaregistrar.com', 'ns2.metaregistrar.com']);
            $conn->logout();
        }
    }
} catch (eppException $e) {
    echo "ERROR: " . $e->getMessage() . "\n";
    echo $e->getLastCommand();
    echo "\n\n";
}