0

I'm using this code to connect to a registrar via TCP.

stream_socket_client('tcp://registrarwebsite:700', $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $fc)

Connection was successful, as for $fc, I am using stream_context_create to pass SSL certificate and key. At this point, everything works fine.

  $fc = stream_context_create(array(
            'ssl' => array('allow_self_signed' => true,
                'local_cert' => 'ma_registrar_cert.pem',
                'local_pk' => 'ma_registrar_key.pem'
        )));

I want to add an XML request to stream_context_create, to send XML EPP requests to the distant server.

How to do that?

Edit

This is an example of the XML request I want to send to the server along with the stream context.

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>     
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"> 
  <command> 
    <create> 
      <domain:create xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"> 
        <domain:name>testdomain.com</domain:name> 
        <domain:period unit="y">testdomain.com</domain:period> 
        <domain:registrant>John Doe</domain:registrant> 
      </domain:create> 
    </create> 
    <clTRID>reference</clTRID> 
  </command> 
</epp>
zx485
  • 28,498
  • 28
  • 50
  • 59
SmootQ
  • 2,096
  • 7
  • 33
  • 58

1 Answers1

1

See my other answer here: https://stackoverflow.com/a/47982304/6368697 to your related question. You basically do not implement the EPP protocol correctly.

Patrick Mevzek
  • 10,995
  • 16
  • 38
  • 54
  • @NixonKosgei If you have a new specific question, create a separate post. Did you look at the linked answer? Basically you need to start by following closely the specifications, that is the RFC. Each EPP frame is prefixed by its length on 4 bytes. Any useful EPP library abstracts that for you. After doing that, what other problems remain? – Patrick Mevzek Nov 25 '19 at 05:01