metaregistrar / php-epp-client

Object-oriented PHP EPP Client

Home Page:https://www.metaregistrar.com/docs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't find a way to get current dnssec keys

basd82 opened this issue · comments

``i made function based infodomain example:

function infodomain($conn, $domainname)
{
	$antwoord = array();
	$info     = new eppInfoDomainRequest(new eppDomain($domainname));
	if ($response = $conn->request($info))
	{
		/* @var $response Metaregistrar\EPP\eppInfoDomainResponse */
		$d                  = $response->getDomain();
		$antwoord['Domain'] = $d->getDomainname();
		$nameservers = array();
		foreach ($d->getHosts() as $nameserver)
		{
			/* @var $nameserver eppHost */
			array_push($nameservers, $nameserver->getHostname());
		}
		$antwoord['nameservers'] = $nameservers;
		return $antwoord;
	}
}

What i can't get is dnssec info can tell how to get that info ?

When you create the connection, you have to indicate that DNSSEC must be enabled. This makes sure that when logging in, the DNSSEC extensions are added to the login.

So after creating $conn, add $conn->enableDNSSEC();

When you create the connection, you have to indicate that DNSSEC must be enabled. This makes sure that when logging in, the DNSSEC extensions are added to the login.

So after creating $conn, add $conn->enableDNSSEC();

I added like you sugested:

try {
    // Please enter your own settings file here under before using this example
    if ($conn = eppConnection::create('../Registries/settings.ini')) {
        // Connect to the EPP server
        if ($conn->login()) {
            $conn->enableDNSSEC();
            $result = infodomain($conn, $domainname);
            $conn->logout();
        }
    }
}

The secdns stays empty:

Metaregistrar\EPP\eppDomain Object
(
    [domainname:Metaregistrar\EPP\eppDomain:private] => hobby.nl
    [registrant:Metaregistrar\EPP\eppDomain:private] => HCC000063-HCCVC
    [contacts:Metaregistrar\EPP\eppDomain:private] => Array
        (
            [0] => Metaregistrar\EPP\eppContactHandle Object
                (
                    [contactHandle:Metaregistrar\EPP\eppContactHandle:private] => DIK002355-HCCVC
                    [contactType:Metaregistrar\EPP\eppContactHandle:private] => admin
                    [password:Metaregistrar\EPP\eppContactHandle:private] =>
                )

            [1] => Metaregistrar\EPP\eppContactHandle Object
                (
                    [contactHandle:Metaregistrar\EPP\eppContactHandle:private] => DIK002355-HCCVC
                    [contactType:Metaregistrar\EPP\eppContactHandle:private] => tech
                    [password:Metaregistrar\EPP\eppContactHandle:private] =>
                )

        )

    [hosts:Metaregistrar\EPP\eppDomain:private] => Array
        (
            [0] => Metaregistrar\EPP\eppHost Object
                (
                    [hostname:Metaregistrar\EPP\eppHost:private] => pdns1.hobby.nl
                    [ipaddresses:Metaregistrar\EPP\eppHost:private] =>
                    [hoststatus:Metaregistrar\EPP\eppHost:private] =>
                )

            [1] => Metaregistrar\EPP\eppHost Object
                (
                    [hostname:Metaregistrar\EPP\eppHost:private] => pdns4.hobby.nl
                    [ipaddresses:Metaregistrar\EPP\eppHost:private] =>
                    [hoststatus:Metaregistrar\EPP\eppHost:private] =>
                )

            [2] => Metaregistrar\EPP\eppHost Object
                (
                    [hostname:Metaregistrar\EPP\eppHost:private] => pdns2.hobby.nl
                    [ipaddresses:Metaregistrar\EPP\eppHost:private] =>
                    [hoststatus:Metaregistrar\EPP\eppHost:private] =>
                )

            [3] => Metaregistrar\EPP\eppHost Object
                (
                    [hostname:Metaregistrar\EPP\eppHost:private] => pdns3.hobby.nl
                    [ipaddresses:Metaregistrar\EPP\eppHost:private] =>
                    [hoststatus:Metaregistrar\EPP\eppHost:private] =>
                )

        )

    [statuses:Metaregistrar\EPP\eppDomain:private] => Array
        (
        )

    [secdns:Metaregistrar\EPP\eppDomain:private] => Array
        (
        )

    [authorisationCode:Metaregistrar\EPP\eppDomain:private] => DNCXDJtgQMVU
    [periodunit:Metaregistrar\EPP\eppDomain:private] => y
    [period:Metaregistrar\EPP\eppDomain:private] => 1
)

Can you try this:
/* @var $response Metaregistrar\EPP\eppDnssecInfoDomainResponse */

The response you get should contain DNSSEC information, properly formatted in eppDnssecInfoDomainResponse

No result

did you mean it like this ?

<?php
require('../autoloader.php');

use Metaregistrar\EPP\eppConnection;
use Metaregistrar\EPP\eppException;
use Metaregistrar\EPP\eppDomain;
use Metaregistrar\EPP\eppInfoDomainRequest;
use Metaregistrar\EPP\eppContactHandle;
use Metaregistrar\EPP\eppHost;


/*
 * This script retrieves all information for a specific domain name
 */


if ($argc <= 1) {
    echo "Usage: infodomain.php <domainname>\n";
    echo "Please enter a domain name retrieve\n\n";
    die();
}
$domainname = $argv[1];

echo "Retrieving info on " . $domainname . "\n";
try {
    // Please enter your own settings file here under before using this example
    if ($conn = eppConnection::create('../Registries/settings.ini')) {
        // Connect to the EPP server
        if ($conn->login()) {
            $conn->enableDNSSEC();
            $result = infodomain($conn, $domainname);
            $conn->logout();
        }
    }
} catch (eppException $e) {
    echo "ERROR: " . $e->getMessage() . "\n\n";
}

/**
 * @param $conn Metaregistrar\EPP\eppConnection
 * @param $domainname string
 * @return string
 */
function infodomain($conn, $domainname) {
    $info = new eppInfoDomainRequest(new eppDomain($domainname));
    if ($response = $conn->request($info)) {
        /* @var $response Metaregistrar\EPP\eppInfoDomainResponse */
        /* @var $response Metaregistrar\EPP\eppDnssecInfoDomainResponse */
        $d = $response->getDomain();
        echo print_r($d,true);
        echo "Info domain for " . $d->getDomainname() . ":\n";
        echo "Created on " . $response->getDomainCreateDate() . "\n";
        echo "Last update on ".$response->getDomainUpdateDate()."\n";
        echo "Registrant " . $d->getRegistrant() . "\n";
        echo "Contact info:\n";
        foreach ($d->getContacts() as $contact) {
            /* @var $contact eppContactHandle */
            echo "  " . $contact->getContactType() . ": " . $contact->getContactHandle() . "\n";
        }
        echo "Nameserver info:\n";
        foreach ($d->getHosts() as $nameserver) {
            /* @var $nameserver eppHost */
            echo "  " . $nameserver->getHostname() . "\n";
        }
    } else {
        echo "ERROR2\n";
    }
    return null;
}

Yes, you can safely remove /* @var $response Metaregistrar\EPP\eppInfoDomainResponse */

with eppDnssecInfoDomainResponse you should see the DNSSEC information.