Inheritance: extends tmchConnection
/**
 * @param eppConnection $conn
 * @param string $domainname
 * @return array|null
 * @throws eppException
 * @throws tmchException
 */
function checkdomainclaim($conn, $domainname)
{
    $check = new eppLaunchCheckRequest(array($domainname));
    $check->setLaunchPhase(eppLaunchCheckRequest::PHASE_CLAIMS, null, eppLaunchCheckRequest::TYPE_CLAIMS);
    if ($response = $conn->request($check)) {
        //$phase = $response->getLaunchPhase();
        /* @var Metaregistrar\EPP\eppLaunchCheckResponse $response */
        $checks = $response->getDomainClaims();
        foreach ($checks as $check) {
            echo $check['domainname'] . " has " . ($check['claimed'] ? 'a claim' : 'no claim') . "\n";
            if ($check['claimed']) {
                if ($check['claim']) {
                    if ($check['claim'] instanceof eppDomainClaim) {
                        echo "Claim validator: " . $check['claim']->getValidator() . ", claim key: " . $check['claim']->getClaimKey() . "\n";
                        $tmch = new cnisTmchConnection(true, 'settingslive.ini');
                        $claim = array();
                        $output = $tmch->getCnis($check['claim']->getClaimKey());
                        /* @var $output Metaregistrar\TMCH\tmchClaimData */
                        $claim['noticeid'] = $output->getNoticeId();
                        $claim['notafter'] = $output->getNotAfter();
                        $claim['confirmed'] = gmdate("Y-m-d\\TH:i:s\\Z");
                        return $claim;
                    } else {
                        throw new eppException("Domain name " . $check['domainname'] . " is claimed, but no valid claim key is present");
                    }
                } else {
                    throw new eppException("Domain name " . $check['domainname'] . " is claimed, but no claim key is present");
                }
            }
        }
    } else {
        echo "ERROR2\n";
    }
    return null;
}
/**
 * @param $conn eppConnection
 * @param $domains array
 */
function checkdomains($conn, $domains)
{
    try {
        $check = new eppLaunchCheckRequest($domains);
        $check->setLaunchPhase(eppLaunchCheckRequest::PHASE_CLAIMS, 'test', eppLaunchCheckRequest::TYPE_CLAIMS);
        if ($response = $conn->request($check)) {
            /* @var $response Metaregistrar\EPP\eppLaunchCheckResponse */
            //$phase = $response->getLaunchPhase();
            $checks = $response->getDomainClaims();
            foreach ($checks as $check) {
                echo $check['domainname'] . " has " . ($check['claimed'] ? 'a claim' : 'no claim') . "\n";
                if ($check['claimed']) {
                    if ($check['claim']) {
                        if ($check['claim'] instanceof eppDomainClaim) {
                            echo "Claim validator: " . $check['claim']->getValidator() . ", claim key: " . $check['claim']->getClaimKey() . "\n";
                            // Do not forget to fill in the CNIS login details!
                            $tmch = new cnisTmchConnection('');
                            $output = $tmch->getCnis($check['claim']->getClaimKey());
                            echo "Notice ID: " . $output->getNoticeId() . " Not after: " . $output->getNotAfter() . "\n";
                        } else {
                            throw new Metaregistrar\EPP\eppException("Domain name " . $check['domainname'] . " is claimed, but no valid claim key is present");
                        }
                    } else {
                        throw new Metaregistrar\EPP\eppException("Domain name " . $check['domainname'] . " is claimed, but no claim key is present");
                    }
                }
            }
        } else {
            echo "ERROR2\n";
        }
    } catch (eppException $e) {
        echo 'ERROR1: ' . $e->getMessage() . "\n";
    } catch (tmchException $t) {
        echo 'ERROR TMCH: ' . $t->getMessage() . "\n";
    }
}
<?php

require "../autoloader.php";
use Metaregistrar\TMCH\dnlTmchConnection;
use Metaregistrar\TMCH\cnisTmchConnection;
use Metaregistrar\TMCH\tmchException;
$domain = 'nike';
$domainkey = null;
try {
    $dnl = new dnlTmchConnection();
    $dnl->setConnectionDetails('.');
    $cnis = new cnisTmchConnection();
    $cnis->setConnectionDetails('');
    $list = $dnl->getDnl();
    if (count($list) == 1) {
        echo "empty list received\n";
        echo $list[0] . "\n";
    } else {
        foreach ($list as $line) {
            if (strlen($line) > 0) {
                list($domainname, $key) = explode(',', $line);
                if ($domainname == $domain) {
                    $domainkey = $key;
                }
            }
        }
        if ($domainkey) {
            echo $cnis->showWarning($cnis->getCnis($domainkey), false);
        } else {
            echo "Domain name not found in CNIS list\n";
        }
<?php

require "../autoloader.php";
use Metaregistrar\TMCH\dnlTmchConnection;
use Metaregistrar\TMCH\cnisTmchConnection;
use Metaregistrar\TMCH\tmchException;
/* This test file retrieves the latest test-domain-name-list (DNL) and gets the claim notice from the first item of this list. */
try {
    $dnl = new dnlTmchConnection();
    $dnl->setConnectionDetails('');
    $cnis = new cnisTmchConnection();
    $cnis->setConnectionDetails('');
    $list = $dnl->getDnl();
    $linecounter = -1;
    $k = array();
    foreach ($list as $line) {
        if ($linecounter > 0 && strlen($line) > 0) {
            list($domainname, $key, $datetime) = explode(',', $line);
            if ($domainname != '1' and $domainname != 'DNL') {
                echo $linecounter . ": " . $domainname . "\n";
                $k[$linecounter] = $key;
            }
        }
        $linecounter++;
    }
    echo "Enter the number from one of the labels above to display the warning notice for this label\n:";
    $number = (int) fgets(STDIN);
    echo $cnis->showWarning($cnis->getCnis($k[$number]));
} catch (tmchException $e) {
    echo "ERROR: " . $e->getMessage() . "\n";
}