metaregistrar / php-epp-client

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

Premium Domain Support #175

Closed swartjie closed 5 years ago

swartjie commented 5 years ago

hey Guys, I tried to have a look, but I could not find any info on it between the files... Does the class support premium domain names? And check's etc?

I look forward to hearing from you.

metaregistrar commented 5 years ago

I have started work on supporting the fee extension https://github.com/metaregistrar/php-epp-client/tree/master/Protocols/EPP/eppExtensions/fee-1.0

However, this is not ready yet as i was struggling to find a good dev environment to test the extension.

swartjie commented 5 years ago

Is there anything I can help with? The co.za registry does support premium domains, So if need be, i'd be happy to provide assistance as I would LOVE to be able to add premium support in my integration :)

swartjie commented 5 years ago

Is there a way to actually handle the premium extensions in the meentime? Even if I have to do some manual checks from my side?

metaregistrar commented 5 years ago

I see that ZACR uses the CHARGE-1.0 extension to check domain prices for premium domains. I will see if the extension i created earlier will work here.

swartjie commented 5 years ago

That would be wonderful. If there is anything I can do to help please let me know :) I know the class is free, but even if all I can do is make a donation to support it, please let me know where. I love this class!!!

Solve my Premium domain issues and you'll solve the last woe's of my life :D ;)

metaregistrar commented 5 years ago

The premium commands to check, create and info domain are added to the latest dev version.

Example for a check command:

metaregistrar commented 5 years ago

The ZACR premium commands have all been incorporated into the latest DEV code.

You can now check a domain name, get the premium domain info, and then create the domain name using the premium info

function premiumcheck($conn, $domainname) {
    $check = new eppCheckDomainRequest(new eppDomain($domainname));
    if ($response = $conn->request($check)) {
        /* @var $response chargeEppCheckDomainResponse */
        echo $response->saveXML();
        return $response->getChargeForDomainName($domainname);
    } else {
        echo "ERROR2\n";
    }
    return null;
}

function premiumcreate($conn, $domainname, $registrant, $nameservers) {
    $charge = premiumcheck($conn, $domainname);
    $domain = new eppDomain($domainname);
    $domain->setRegistrant($registrant);
    $domain->addContact(new eppContactHandle($registrant,eppContactHandle::CONTACT_TYPE_ADMIN));
    $domain->addContact(new eppContactHandle($registrant,eppContactHandle::CONTACT_TYPE_TECH));
    $domain->addContact(new eppContactHandle($registrant,eppContactHandle::CONTACT_TYPE_BILLING));
    $domain->setAuthorisationCode('dkjdkejdedj');
    foreach ($nameservers as $ns) {
        $domain->addHost(new eppHost($ns));
    }
    $create = new chargeEppCreateDomainRequest($domain, true);
    $create->addDomainCharge($charge);
    if ($response = $conn->request($create)) {
        /* @var $response chargeEppCreateDomainResponse */
        echo $response->saveXML();
    }
}
swartjie commented 5 years ago

Hey Bud, Can you tell me, how can I create the cozaEppConnection though? I also asked in the other thread, The connection fails with a class does not exist error, but when I try to define it, It does not work...

What Use's should I have included?

metaregistrar commented 5 years ago

Please make sure you have downloaded the latest dev version, because i have not made these alterations into a new official version yet.

You can either: include autoload.php from the start directory of the php-epp-client source code or Use composer to load the classes

Which method are you using?

swartjie commented 5 years ago

I am loading the autoload.php file, but I still need to define the classes I use like below for example:|

use Metaregistrar\EPP\eppConnection; use Metaregistrar\EPP\eppException; use Metaregistrar\EPP\eppCheckDomainRequest;

metaregistrar commented 5 years ago

Ok, you can then use Metaregistrar\EPP\cozaEppConnection

Does that work for you?

swartjie commented 5 years ago

I still get Error: Class 'Metaregistrar\EPP\cozaEppConnection' not found in when I call $this->conn = new Metaregistrar\EPP\cozaEppConnection(TRUE);

I also added the use clause as: use Metaregistrar\EPP\cozaEppConnection; at the top of the form...

metaregistrar commented 5 years ago

In that case, there is something wrong with the includes in autoload.php Can you check if Registries/cozaEppConnection/eppConnection.php exists in your source code?

What you can also do is mimick cozaEppConnection by changing your code as this:

$conn = new Metaregistrar/EPP/eppConnection(true);
$conn->setServices(array('urn:ietf:params:xml:ns:domain-1.0' => 'domain', 'urn:ietf:params:xml:ns:contact-1.0' => 'contact'));
$conn->useExtension('cozacontact-1.0');
$conn->useExtension('charge-1.0');
swartjie commented 5 years ago

I am now getting: An Error Occurred Packet size is too big: 352518908. Closing connection

The Registries/cozaEppConnection/eppConnection.php is there... And I even changed my code as below to try and accommodate...

if($coza_epp_connection == false){ $this->conn = new Metaregistrar\EPP\eppConnection(TRUE); }else{ $this->conn = new Metaregistrar\EPP\eppConnection(true); $this->conn->setServices(array('urn:ietf:params:xml:ns:domain-1.0' => 'domain', 'urn:ietf:params:xml:ns:contact-1.0' => 'contact')); $this->conn->useExtension('cozacontact-1.0'); $this->conn->useExtension('charge-1.0'); //$this->conn = new Metaregistrar\EPP\cozaEppConnection(TRUE); }

And ofcourse the coza_epp_connection variable is set to true when calling this...

metaregistrar commented 5 years ago

Packet size too big is an encryption problem.

Please use ssl://servername as hostname instead of just servername

swartjie commented 5 years ago

Looks like that worked you golden star!!!! But previously I had ti remove the ssl:// to get the other epp commands working. Would this then now bugger those around?

metaregistrar commented 5 years ago

No, in the latest versions the php-epp-client has a revamped connection and login procedure. In the older versions there were 2 connection procedures, one would add ssl:// to your hostname and the other would not. That caused a lot of confusion, so now there is only one procedure, and you have to set ssl:// yourself depending if you want an encrypted connection or not.

swartjie commented 5 years ago

Oh it makes sense... One last question... How will I go about making glue records through your class?

With the coza structure and your module that became very confusing to me very fast... Wondering how to define the IP's to the domain etc...

metaregistrar commented 5 years ago

COZA does not use host objects, but host attributes. Normally you would create a host object with an IP address, but in the case of COZA you need to use the hostattr parts to do that.

php-epp-client will take care of this automatically for you, just when creating or updating a domain name set $forcehostattr to true.

If you have created eppHost objects with host names including an IP address, then php-epp-client will transmit them as hostattr commands instead of host commands.

Of course, in the case of glue records, you first will have to create the domain name (without nameservers), and when it is created you can modify the domain name with host records including IP addresses.

swartjie commented 5 years ago

Quick follow up on the Premium domain feature... As mentioned before, I can't call teh cozaEppConnection, yougave me an alternative for the balance check, but what should I do in the case of the Premium domain check?

Cause I checked aaz.co.za which should've been shown as premium, but was not.. All 3 letter domains in co.za sphere are premium, but this one just shows as available with no pricing info or category info...

metaregistrar commented 5 years ago

The balance check works exactly the same, you can use my work-around for that.

All 3-letter combinations are premiums, but not in CO.ZA and NET.ZA and ORG.ZA, i already found that out while testing. The premium domain extension only works for the gTLD domain names, durban, capetown, etc.