Reputation: 312
I've been in the process of searching for the code all day, and now I've decided to write it here.
First Login:
<epp xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<login>
<clID>ClientX</clID>
<pw>epp123</pw>
<options>
<version>1.0</version>
<lang>en</lang>
</options>
<svcs>
<objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
<svcExtension>
<extURI>http://test/epp/xml/schema/contact-ext-1.0</extURI>
</svcExtension>
</svcs>
</login>
<clTRID>ABC-12345</clTRID>
</command>
</epp>
Then: Some XML
And then Logout:
<epp xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<logout />
<clTRID>ABC-12345</clTRID>
</command>
</epp>
How can I send this data and then receive data from the server? Can anyone send me example?
Thank you
Upvotes: 0
Views: 1608
Reputation: 12485
How can I send this data and then receive data from the server?
Read RFC 5734 "Extensible Provisioning Protocol (EPP) Transport over TCP" multiple times, and very carefully.
Of course to really understand it you will need to read all RFCs regarding EPP, that is RFC 5730 to 5733 and then if you are serious about being a registrar you will need to read the one on RGP and the one on secDNS-1.1 for the 2 major extensions used almost everywhere. Then of course registry specific extensions (I believe you are trying to connect to EURid or DNSBelgium).
In short:
<greeting>
objURI
and extURI
from there to build your <login>
correctly (check registry documentation for which extensions are mandatory)<login>
frameMake sure to understand from RFC 5734 that each EPP frame has to be prefixed by 4 octets encoding the length of the frame: on input (from registry) this let you know how much data you are getting, on output you have to generate it properly, otherwise the registry won't read your response.
If you are beginning in the registrar world, building from scratch a proper EPP client may not be the most desirable job, and I wouldn't necessarily recommend you to do that. There are a lot of small details to get right, specifically if you plan to connect to different registries.
If you search on EPP
tag here you can easily find other questions, and answers that should help you:
You can also find that PHP libraries exist to do EPP so this might save you some time (and make you loose some in understanding the library and fitting it in your own ecosystem). See centralnic PHP EPP library - login frame for a lead for example.
PS: I participated in EPP specifications, and wrote multiple EPP clients and servers over the last 20 years or so.
Upvotes: 2
Reputation: 4373
First, you need to check how the server API is expecting to receive this data. So far we know it's expecting XML but how is the XML to be delivered? Questions you should ask:
The underlying transport mechanism of most web APIs is through HTTP requests. For that you could use PHP native libraries like cURL or PHP libraries like Guzzle. Guzzle is a good one if you are dealing with a REST API.
But you can also find more specific libraries like the SOAP client if you are dealing with a SOAP API
UPDATE:
I just realized EPP is the protocol. Let me know if this link helps, it uses cURL:
https://doc.openprovider.eu/Example_Script_EPP_PHP
Upvotes: 1