dsizmmwnm56437180 2017-07-25 12:09
浏览 67
已采纳

在PHP中通过TCP发送XML EPP请求

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>
  • 写回答

1条回答 默认 最新

  • doushi3189 2017-12-26 18:26
    关注

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 CSS实现渐隐虚线框
  • ¥15 有没有帮写代码做实验仿真的
  • ¥30 vmware exsi重置后登不上
  • ¥15 易盾点选的cb参数怎么解啊
  • ¥15 MATLAB运行显示错误,如何解决?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?
  • ¥15 电磁场的matlab仿真