request() public method

public request ( eppRequest $eppRequest ) : eppResponse | null
$eppRequest eppRequest
return eppResponse | null
/**
 * @param eppConnection $conn
 * @param string $domainname
 * @param string $authcode
 */
function transferdomain($conn, $domainname, $authcode)
{
    try {
        $domain = new eppDomain($domainname);
        $domain->setAuthorisationCode($authcode);
        $transfer = new eppTransferRequest(eppTransferRequest::OPERATION_REQUEST, $domain);
        if ($response = $conn->request($transfer)) {
            /* @var $response Metaregistrar\EPP\eppTransferResponse */
            echo $response->getDomainName(), " transfer request was succesful\n";
        }
    } catch (eppException $e) {
        echo $e->getMessage() . "\n";
    }
}
/**
 * @param eppConnection $conn
 * @param string $email
 * @param string $telephone
 * @param string $name
 * @param string $organization
 * @param string $address
 * @param string $postcode
 * @param string $city
 * @param string $country
 * @return null|string
 */
function createcontact($conn, $email, $telephone, $name, $organization, $address, $postcode, $city, $country)
{
    try {
        $contact = new Metaregistrar\EPP\eppContact(new Metaregistrar\EPP\eppContactPostalInfo($name, $city, $country, $organization, $address, null, $postcode, Metaregistrar\EPP\eppContact::TYPE_LOC), $email, $telephone);
        $create = new Metaregistrar\EPP\EppCreateContactRequest($contact);
        if ($response = $conn->request($create)) {
            /* @var $response Metaregistrar\EPP\eppCreateContactResponse */
            echo "Contact created on " . $response->getContactCreateDate() . " with id " . $response->getContactId() . "\n";
            return $response->getContactId();
        }
    } catch (Metaregistrar\EPP\eppException $e) {
        echo $e->getMessage() . "\n";
    }
    return null;
}
/**
 * @param eppConnection $conn
 * @return null
 */
function poll($conn)
{
    try {
        $poll = new eppPollRequest(eppPollRequest::POLL_REQ, 0);
        if ($response = $conn->request($poll)) {
            /* @var $response Metaregistrar\EPP\eppPollResponse */
            if ($response->getResultCode() == eppResponse::RESULT_MESSAGE_ACK) {
                //echo $response->saveXML();
                echo $response->getMessageCount() . " messages waiting in the queue\n";
                echo "Picked up message " . $response->getMessageId() . ': ' . $response->getMessage() . "\n";
                return $response->getMessageId();
            } else {
                echo $response->getResultMessage() . "\n";
            }
        }
    } catch (eppException $e) {
        echo $e->getMessage() . "\n";
    }
    return null;
}
/**
 * @param eppConnection $conn
 * @param string $domainname
 * @param string $registrant
 * @param string $admincontact
 * @param string $techcontact
 * @param string $billingcontact
 * @param array $nameservers
 * @throws eppException
 */
function createdomain($conn, $domainname, $registrant, $admincontact, $techcontact, $billingcontact, $nameservers)
{
    $domain = new eppDomain($domainname, $registrant);
    $reg = new eppContactHandle($registrant);
    $domain->setRegistrant($reg);
    $admin = new eppContactHandle($admincontact, eppContactHandle::CONTACT_TYPE_ADMIN);
    $domain->addContact($admin);
    $tech = new eppContactHandle($techcontact, eppContactHandle::CONTACT_TYPE_TECH);
    $domain->addContact($tech);
    $billing = new eppContactHandle($billingcontact, eppContactHandle::CONTACT_TYPE_BILLING);
    $domain->addContact($billing);
    $domain->setAuthorisationCode($domain->generateRandomString(8));
    if (is_array($nameservers)) {
        foreach ($nameservers as $nameserver) {
            $host = new eppHost($nameserver);
            $domain->addHost($host);
        }
    }
    $create = new eppCreateDomainRequest($domain);
    if ($response = $conn->request($create)) {
        /* @var $response Metaregistrar\EPP\eppCreateResponse */
        echo "Domain " . $response->getDomainName() . " created on " . $response->getDomainCreateDate() . ", expiration date is " . $response->getDomainExpirationDate() . "\n";
    }
}
/**
 * @param eppConnection $conn
 * @param string $domainname
 * @param string $registrant
 * @param string $admincontact
 * @param string $techcontact
 * @param string $billingcontact
 * @param array $nameservers
 */
function createdomain($conn, $domainname, $registrant, $admincontact, $techcontact, $billingcontact, $nameservers)
{
    /* @var $conn Metaregistrar\EPP\eppConnection */
    try {
        $domain = new eppDomain($domainname, $registrant);
        $domain->setRegistrant(new eppContactHandle($registrant));
        $domain->addContact(new eppContactHandle($admincontact, eppContactHandle::CONTACT_TYPE_ADMIN));
        $domain->addContact(new eppContactHandle($techcontact, eppContactHandle::CONTACT_TYPE_TECH));
        $domain->addContact(new eppContactHandle($billingcontact, eppContactHandle::CONTACT_TYPE_BILLING));
        $domain->setAuthorisationCode('rand0m');
        if (is_array($nameservers)) {
            foreach ($nameservers as $nameserver) {
                $domain->addHost(new eppHost($nameserver));
            }
        }
        $create = new eppCreateDomainRequest($domain);
        if ($response = $conn->request($create)) {
            /* @var $response Metaregistrar\EPP\eppCreateDomainResponse */
            echo "Domain " . $response->getDomainName() . " created on " . $response->getDomainCreateDate() . ", expiration date is " . $response->getDomainExpirationDate() . "\n";
        }
    } catch (eppException $e) {
        echo $e->getMessage() . "\n";
    }
}