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>
See my other answer here: https://stackoverflow.com/a/47982304/6368697 to your related question. You basically do not implement the EPP protocol correctly.