1

我正在编写域注册脚本,当我连接到 EPP 服务器时,出现以下错误:

PHP 致命错误:未捕获的异常:在不允许时收到 HTTP/0.9

Curl 包含了 nghttp2,所以这不是错误

我正在运行 PHP 7.4

 $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">
  <command>
<login>
   ......removed ...
    </login>
    
  </command>
</epp>';


//The URL that you want to send your XML to.
$url = 'https://xxxxx.com:700';
if(function_exists('curl_init') === true){
    //curl_init is not defined
    echo"cURL enabled";
}
//Initiate cURL
$curl = curl_init($url);

//Set the Content-Type to text/xml.
curl_setopt ($curl, CURLOPT_HTTPHEADER, array("Content-Type: text/xml"));

//Set CURLOPT_POST to true to send a POST request.
curl_setopt($curl, CURLOPT_POST, true);

//Attach the XML string to the body of our request.
curl_setopt($curl, CURLOPT_POSTFIELDS, $xml);

//Tell cURL that we want the response to be returned as
//a string instead of being dumped to the output.
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

//Execute the POST request and send our XML.
$result = curl_exec($curl);



//Do some basic error checking.
if(curl_errno($curl)){
    throw new Exception(curl_error($curl));
    echo $curl;
}

有任何想法吗?谢谢

4

0 回答 0