EPP调用在xml帖子上返回空值

时间:2015-01-20 15:06:38

标签: php xml sockets epp

我正在尝试连接epp并提交xml,但除了'server connected'之外它什么也没有返回。

$xml = '<?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">
  <hello />
</epp>';


$output = '';

$fp = fsockopen("epp.host.com", 44, $errno, $errstr);
if(!$fp) {
    echo "ERROR: $errno - $errstr<br />\n";
} 
else{
    echo "epp connected\r\n";
    fwrite($fp, $xml."\r\n");
    while(!feof($fp)){
        $output .= fgets($fp, 128);
    }
    fclose($fp);
}

$result = strtok($output, "\n");

echo $result;

您能否在此代码中提出我想要解决的问题。感谢

1 个答案:

答案 0 :(得分:0)

您没有提供足够的信息。 EPP并不像那样,你至少缺少两点:

  1. EPP需要TLS,所以在做其他事情之前你需要建立你的TLS连接(带证书)
  2. 在EPP中发言的第一方是服务器,向客户端发送greeting节点;作为客户,你应该阅读它(它包含有用的信息),然后回复。