GithubHelp home page GithubHelp logo

africc / php-epp2 Goto Github PK

View Code? Open in Web Editor NEW
54.0 54.0 31.0 347 KB

A High Level EPP TCP/SSL Client for PHP

License: GNU General Public License v3.0

PHP 99.89% Makefile 0.11%
client composer-package domains epp library packagist php registrar registry tld

php-epp2's People

Contributors

bessone avatar bgentil avatar dependabot[bot] avatar domainregistrar avatar greenmato avatar jbarbede avatar jkaflik avatar johnny-bit avatar krtcom avatar lifeofguenter avatar panaceya avatar pavkatar avatar scrutinizer-auto-fixer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-epp2's Issues

Change host ( name server )

How can i update name server ?

$frame = new UpdateHost;
$frame->setHost('ns1.example.com');
$frame->changeHost('ns1.anotherexample.com');

response - "Unimplemented option"

Domain listing

Is there any standardized frame by which you can request the entire domain listing of your user account?

Missing socket on conect

Hello ,

When I try to connect, the Client.php throws an exception at 133 line .
Also there is no message ,
$errno have value "0" and $errstr have value "" .

Client.php 133 line :
if ($this->socket === false) { throw new Exception($errstr, $errno); }

How I try to connect:

   $realPath = realpath(APPLICATION_PATH . '/data/keys/ficora.pem'); 
        if (!$realPath) {
            throw new \Exception('Missing PEM!');
        }

        $epp_client = new EPPClient([
            'host' => 'epptest.ficora.fi',
            'port' => 700,
            'username' => '******',
            'password' => '******',
            'connect_timeout' => 30,
            'services' => [
                'urn:ietf:params:xml:ns:domain-1.0',
                'urn:ietf:params:xml:ns:contact-1.0',
                'urn:ietf:params:xml:ns:host-1.0',
                'urn:ietf:params:xml:ns:epp-1.0'
            ],
            'local_cert' => $realPath,
            'pass_phrase' => '******',
            'ssl' => true,
            'debug' => true,
        ]);


        try {
            $greeting = $epp_client->connect();
        } catch (\Exception $e) {
            var_dump($e->getLine(), $e->getFile(), $e->getMessage(), $e->getTrace());
            $epp_client->close();
            exit;
        }

addDisclose

addDisclose seems to do nothing. Ideal should produce:

< epp xmlns="urn:ietf:params:xml:ns:epp-1.0" >
< command >
< update >
< contact:update
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0" >
< contact:id >id8013< /contact:id >
< contact:ch g>
< contact:disclose flag="1" / >
< /contact:chg >
< /contact:update >
< /update >
< /command >
< /epp >

Space added to stop XML being stripped.

Nominet Class

i have see a nominet extention was added how we can use it ?

dash in attribute

I need add custom attribute with dash.
like:

$frame->set("contact:ident[@legal-form='PERS']", '30.3.1911');

But is throw Uncaught DOMException: Namespace Error
please add support fo dash

Response->data() bails too early

Hi!

Current implementation of Response->data() method bails too early - returns empty response where response from epp has data, but only in extension part.

for example:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="http://www.dns.pl/nask-epp-schema/epp-2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:extreport="http://www.dns.pl/nask-epp-schema/extreport-2.0" xsi:schemaLocation="http://www.dns.pl/nask-epp-schema/epp-2.0 epp-2.0.xsd">
    <response>
        <result code="1000">
            <msg lang="en">Command completed successfully</msg>
        </result>
        <extension>
            <extreport:reportData xmlns:extreport="http://www.dns.pl/nask-epp-schema/extreport-2.0" xsi:schemaLocation="http://www.dns.pl/nask-epp-schema/extreport-2.0 extreport-2.0.xsd">
                <extreport:domDataRsp>
                    <extreport:domData>
                        <extreport:name>example1.pl</extreport:name>
                        <extreport:roid>1234-NASK</extreport:roid>
                        <extreport:exDate>2007-03-18T23:00:00.0Z</extreport:exDate>
                        <extreport:statuses>
                            <extreport:status>serverHold</extreport:status>
                        </extreport:statuses>
                    </extreport:domData>
                </extreport:domDataRsp>
                <extreport:offset>0</extreport:offset>
                <extreport:limit>1</extreport:limit>
                <extreport:size>2</extreport:size>
            </extreport:reportData>
        </extension>
        <trID>
            <svTRID>WI4332607665</svTRID>
        </trID>
    </response>
</epp>

This is due to

        $nodes = $this->get('//epp:epp/epp:response/epp:resData');
        if ($nodes === false || !($nodes instanceof DOMNodeList) || $nodes->length === 0 || !$nodes->item(0)->hasChildNodes()) {
            return;
        }

I'll write something that seems sane in a bit. Tossing this here so I don't forget 😉

Why does php-epp2 still timeout in cli call?

Why does php-epp2 still timeout in cli call?

PHP Fatal error: Maximum execution time of 300 seconds exceeded in /AfriCC/EPP/Client.php on line 267

i has been add ini_set('max_execution_time',0), but it is still unresolved.

add new command to library

Hello , i want to add a restore command to the library , but i have a dificult to add it , how i can add this command to the epp class ?
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd"> <command> <update> <domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd"> <domain:name>example.com</domain:name> <domain:chg/> </domain:update> </update> <extension> <rgp:update xmlns:rgp="urn:ietf:params:xml:ns:rgp-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:rgp-1.0 rgp-1.0.xsd"> <rgp:restore op="request"/> </rgp:update> </extension> <clTRID>ABC-12345</clTRID> </command> </epp>

Contact Create: Command Syntax Error

Hello,

I've been writing my own platform based on the same frame you have, but I've actually stumbled upon a possible bug in the code. Specifically Contact Create.

I cannot get the request to work. It always returns Command Syntax Error. I used your library to see the frame and it prints characters '[0m�[1;31m' in the middle of the frame.

<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  <command>
	<create>
	  <contact:create xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
		<contact:id>CONTACT1</contact:id>
		<contact:postalInfo type="loc">
		  <contact:name>Jun Grodotzki</contact:name>
		  <contact:org>weheartwebsites UG</contact:org>
		  <contact:addr>
			<contact:street>Ronskenstrabe 23</contact:street>
			<contact:street>Around the Corner</contact:street>
			<contact:city>Cape Town</contact:city>
			<contact:sp>WC</contact:sp>
			<contact:pc>8001</contact:pc>
			<contact:cc>ZA</contact:cc>
		  </contact:addr>
		</contact:postalInfo>
		<contact:postalInfo type="int">
		  <contact:name>Jun Grodotzki</contact:name>
		  <contact:org>weheartwebsites UG</contact:org>
		  <contact:addr>
			<contact:street>Ronskenstrabe 23</contact:street>
			<co�[0m�[1;31mntact:street>Around the Corner</contact:street>
			<contact:city>Cape Town</contact:city>
			<contact:sp>WC</contact:sp>
			<contact:pc>8001</contact:pc>
			<contact:cc>ZA</contact:cc>
		  </contact:addr>
		</contact:postalInfo>
		<contact:voice>+27.844784784</contact:voice>
		<contact:fax>+1.844784784</contact:fax>
		<contact:email>[email protected]</contact:email>
		<contact:disclose flag="0">
		  <contact:voice/>
		  <contact:email/>
		</contact:disclose>
	  </contact:create>
	</create>
	<clTRID>E1144-5884b4ac5074d</clTRID>
  </command>
</epp>

As you can see contact:street contains odd characters which breaks up the XML? Why? This error seems to be located on the same row, every time. When removing lines or adding them, the error is on the same line.

Ficora EPP

I'm sorry that I have to make an issue out of this but this is partly an issue, partly a question to people who know more about EPP than I. Our national domain registry service (Ficora) just recently transferred to EPP. They basically just dumped some XML on their documentation and an address + port. These are of no real help and we have a deadline to make here as they are shutting down their Web Service 2nd of September.

I've tried all I can, including this library, to connect to epptest.ficora.fi on port 700. Their service requires an SSL certificate and whitelisting to the firewall. I've done the whitelisting by adding my IP address on their dashboard as well as uploaded the SSL certificate in .crt format to my user account there. However, I cannot get through.

Trying to connect to the given address, stream_socket_client() just returns false. This is what I've tried on your Connect.php example:

<?php

// debug
error_reporting(E_ALL);
ini_set('display_errors', true);

chdir(__DIR__);

require '../src/AfriCC/autoload.php';

use AfriCC\EPP\Client as EPPClient;
use AfriCC\EPP\Frame\Command\Create\Domain as CreateDomain;

$epp_client = new EPPClient([
    'host' => 'epptest.ficora.fi',
    'port'  => 700,
    'username' => 'Username',
    'password' => 'password',
    'services' => [
        'urn:ietf:params:xml:ns:domain-1.0',
        'urn:ietf:params:xml:ns:contact-1.0'
    ],
    'ssl' => true,
    'local_cert'    => __DIR__ . '/certificate_file.crt',
    'debug' => true
]);

try {
    $greeting = $epp_client->connect();
} catch(Exception $e) {
    echo $e->getMessage() . PHP_EOL;
}

$epp_client->close();

I then dump stream_socket_client and kill the script. Just returns false. Any help?

Run test

Hi
Why did not add PHPUnit on the composer.json file?
I wanted to run the test but the PHPUnit package does not exist;

Alternatives to intl translisterate

When I tried to use intl transliterator_transliterate function, I got a segmentation fault (probably related to my OS and PHP version) but I didn't get time to investigate why it ocurred. I preferred to switch to derick transliterate function (http://derickrethans.nl/projects.html#translit).

It could be great to get alternatives to translit, including a really basic one that doesn't require a PHP extension and make it configurable.

Client cerificate in epp call

Hello,

How can provide ssl client certificate in epp connection? I have searched everywhere but no solution.

Please help.

extension_xmlns

I'm trying to create extension (Ficora) and I'm facing the ptoblem : Namespace Error
probably because of extension_xmlns value I use .

How this namespace should looks like?
Should I ask Ficora for it ?

Create new element

What if i need to create a new element to send files within the request

to send extra data

like

supportingDocs converted to base64

ResponseFactory::build and handling invalid input

While writing test for pull #65 I wondered about ResponseFactory::build and it's handling of invalid input.

Incorrect input is set to return string with whole input. Shouldn't we handle it by either returning false (1st error condition), throwing exception (2nd) or creating fake response with unsuccessful state (3rd)?

I'd be for handling it as 1 or 2, would signal clearer error ;) fake response would be a bit more to chew :)

How to set custom namespace to all commands/responses?

Hi,

this maybe straightforward, but from single read through I can't figure it out yet - how to set custom namespace for all commands/reponses?

something like:

public static $specs = [
        'epp'     => [
            'xmlns' => '/root/epp-3.0 epp.ns',
        ],
        'domain'  => [
            'xmlns' => '/root/epp/domain-3.0 domain.ns',
        ],
        'host'    => [
            'xmlns' => '/root/epp/host-3.0 host.ns',
        ],
        'contact' => [
            'xmlns' => '/root/epp/contact-3.0 contact.ns',
        ],
    ];

Guzzle

Guzzle is required in the composer file (v. 3 now deprecated) but Guzzle is never used, even the HTTPClient uses Curl directly.

Am I missing something or can it be removed?

Contact type int optional

Nic MX only accepts "loc" type for "contact:postalInfo" and doesn't support "int" type.

Actually "int" type is always added in ContactTrait, we probably need some configuration option to indicate what type(s) should be part of the generated frame.

Composer Release still in 1.0.0

when we use composer to download the package, the version downloaded is 1.0.0 wish it lock some updates from the latest months, please update the release to include the last commit.

Response code definitions

I suggest adding response code definitions (constants) for better understanding of the received number. Maybe the Client class would be the best place for this.

Example: (Taken from the other epp library)

const RESULT_SUCCESS = '1000';
const RESULT_SUCCESS_ACTION_PENDING = '1001';
const RESULT_NO_MESSAGES = '1300';
const RESULT_MESSAGE_ACK = '1301';
const RESULT_LOGOFF_SUCCESS = '1500';
#
# ERROR RESPONSES
#
const RESULT_UNKNOWN_COMMAND = '2000';
const RESULT_SYNTAX_ERROR = '2001';
const RESULT_USE_ERROR = '2002';
const RESULT_PARAMETER_MISSING = '2003';
const RESULT_PARAMETER_RANGE_ERROR = '2004';
const RESULT_PARAMETER_ERROR = '2005';
const RESULT_INVALID_PROTOCOL_VERSION = '2100';
const RESULT_INVALID_COMMAND = '2101';
const RESULT_INVALID_OPTION = '2102';
const RESULT_INVALID_EXTENSION = '2103';
const RESULT_BILLING_FAILURE = '2104';
const RESULT_NO_RENEW_POSSIBLE = '2105';
const RESULT_NO_TRANSFER_POSSIBLE = '2106';
const RESULT_AUTHENTICATION_ERROR = '2200';
const RESULT_AUTHORIZATION_ERROR = '2201';
const RESULT_INVALID_AUTHINFO = '2202';
const RESULT_TRANSFER_PENDING = '2300';
const RESULT_TRANSFER_NOT_PENDING = '2301';
const RESULT_ALREADY_EXISTS = '2302';
const RESULT_NOT_EXISTS = '2303';
const RESULT_OBJECT_STATUS_WRONG = '2304';
const RESULT_ASSOCIATION_EXISTS = '2305';
const RESULT_POLICY_ERROR = '2306';
const RESULT_UNIMPLEMENTED_SERVICE = '2307';
const RESULT_POLICY_VIOLATION = '2308';
const RESULT_COMMAND_FAILED = '2400';
const RESULT_COMMAND_FAILED_CONNECTION_CLOSE = '2500';
const RESULT_AUTHENTICATION_ERROR_CONNECTION_CLOSE = '2501';
const RESULT_SESSION_LIMIT_EXCEEDED_CONNECTION_CLOSE = '2502';

autoload.php file missing

tried to install this.
showing file not found error.
reqired file - vendor/autoload.php

kindly advise from where i could get this file.

Connection Error :-S

PHP Warning: stream_socket_client(): Unable to set local cert chain file `cert/edomains_tawte_2021/certificate_full.pem'; Check that your cafile/capath settings include details of your certificate and its issuer in /home/marcos/Proyectos/afilias-php/vendor/africc/php-epp2/src/AfriCC/EPP/Client.php on line 176
PHP Warning: stream_socket_client(): Failed to enable crypto in /home/marcos/Proyectos/afilias-php/vendor/africc/php-epp2/src/AfriCC/EPP/Client.php on line 176
PHP Warning: stream_socket_client(): unable to connect to tlsv1.2://epp.sandbox.isnic.is:700 (Unknown error) in /home/marcos/Proyectos/afilias-php/vendor/africc/php-epp2/src/AfriCC/EPP/Client.php on line 176

2 codes in XML response

I put an example of a response I got today when testing my app.

We have 2 results elements and RFC allows it indeed.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
    <response>
        <result code="2303">
            <msg lang="en">Object does not exist</msg>
            <value xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
                <domain:hostObj>ns21.yoann.mx</domain:hostObj>
            </value>
        </result>
        <result code="2306">
            <msg lang="en">Parameter value policy error</msg>
            <extValue>
                <value xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
                    <domain:hostObj>ns2.yoann.mx</domain:hostObj>
                </value>
                <reason lang="en">A host that wants to be added is repeated</reason>
            </extValue>
        </result>
        <trID>
            <clTRID>rar_infos-554c07c8a541b</clTRID>
            <svTRID>1163276970</svTRID>
        </trID>
    </response>
</epp>

We need to enhance Response to support it.

sendFrame $header question

Hello ,
what is the purpose of creating a $header and after that appending it to the buffer before sending the request . Client.php

$header = pack('N', mb_strlen($buffer, 'ASCII') + 4);
return $this->send($header . $buffer);

XML request/response logger

Currently, with debug mode, you echo any XML send request/received response and it is already a great help.

We used to log these XML requests and responses in a database. It is really useful when a command failed and we can't exactly determine why (API response sometimes are not really clear). Like that, we can find a request and its response and send it to the API support.

Maybe we should be able to configure a logger when creating a Client object.

set only one contact type (local/international)

in the Create Contact . the class add two type of contact (loc/int) . we can allow creation of "loc" contact only by the function skipInt() , but we can't allow creation of "int" only .

it better to add a new function like forceIntOnly() like

public function forceIntOnly()
{
    $this->force_ascii = false;
    $this->skip_int = false;
    $this->force_int = true;
}

and update the ContactTrait class to use this new fucntion , something like

public function appendName($path, $name)
{
    if ($this->force_ascii) {
        $this->set(sprintf($path, 'loc'), Translit::transliterate($name));
    } else  if (!$this->skip_int) {
        $this->set(sprintf($path, 'int'), Translit::transliterate($name));
    } else if ($this->force_int) {
        $this->set(sprintf($path, 'int'), ($name));
   } else {
        $this->set(sprintf($path, 'loc'), $name);
  }

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.