metaregistrar / php-epp-client

Object-oriented PHP EPP Client
https://www.metaregistrar.com/docs/
MIT License
209 stars 153 forks source link

How to get fees for a domain? #379

Closed anwarsquarebiz closed 2 months ago

anwarsquarebiz commented 2 months ago

Hi Team, The fees extension does not seem to be working. First I tried checkdomain.php but it does not return any fee object.

The I found use Metaregistrar\EPP\feeEppCheckDomainRequest; use Metaregistrar\EPP\feeEppCheckDomainResponse;

However when I created this code

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

use Metaregistrar\EPP\eppConnection; use Metaregistrar\EPP\eppException; use Metaregistrar\EPP\eppCheckDomainRequest; use Metaregistrar\EPP\eppCheckDomainResponse; use Metaregistrar\EPP\feeEppCheckDomainRequest; use Metaregistrar\EPP\feeEppCheckDomainResponse;

/*

if ($argc <= 1) { echo "Usage: checkdomainwithfee.php \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 { // 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('../settings.ini')) { // Connect and login to the EPP server if ($conn->login()) { // Check domain names checkdomains($conn, $domains); $conn->logout(); } } } catch (eppException $e) { echo "ERROR: " . $e->getMessage() . "\n\n"; }

/**

function checkdomains($conn, $domains) { // Create request to be sent to EPP service $check = new feeEppCheckDomainRequest($domains, true);

// Write request to EPP service, read and check the results
if ($response = $conn->request($check)) {
    /* @var $response eppCheckDomainResponse */
    // Walk through the results        
    $checks = $response->getCheckedDomains();    
    // $checks = $response->getCheckedDomains();    
    foreach ($checks as $check) {
        echo $check['domainname'] . " is " . ($check['available'] ? 'free' : 'taken');
        if ($check['available']) {
            echo ' (' . $check['reason'] .')';
        }
        if(isset($check['fee'])) {
            echo " Fee: " . $check['fee'];
        }
        echo "\n";
    }
}

}

It says ERROR: No valid response class found for request class Metaregistrar\EPP\feeEppCheckDomainRequest

Can please give me some example for domain check with fees so that we can implement the same. As fee extension one of the most important part.

metaregistrar commented 2 months ago

Metaregistrar does not support the FEE extension in their EPP implementation. This extension is mainly in php-epp-client because registries use it.

anwarsquarebiz commented 2 months ago

So how do we get the domain price when they are premium domains?