使用PHP中的enom API检查域可用性

时间:2016-10-03 02:10:28

标签: php api

我在我的localhost中测试了enom api的示例php代码,它运行正常。但是,当我在我的Web服务器上测试它时,它失败了。此示例代码使用enom API检查域可用性。 知道为什么会发生这种情况非常感谢。谢谢。我是使用enom API的新手。

  // URL for API request
  $url =  'https://resellertest.enom.com/interface.asp?command=check&sld=enom&tld=com&responsetype=xml&uid=resellid&pw=resellpw';
  // Load the API results into a SimpleXML object
  $xml = simplexml_load_file($url);

  // Read the results
  $rrpCode = $xml->RRPCode;
  $rrpText = $xml->RRPText;

  // Perform actions based on results
  switch ($rrpCode) {
    case 210:
      echo "Domain available";
      break;
    case 211:
      echo "Domain not available";
      break;
    default:
      echo $rrpCode . ' ' . $rrpText;
      break;
  }

错误:


Warning: simplexml_load_file(): SSL operation failed with code 1. OpenSSL Error messages: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure in /home/webdesigndavao/public_html/checkdomain.php on line 26

Warning: simplexml_load_file(): Failed to enable crypto in /home/webdesigndavao/public_html/checkdomain.php on line 26

Warning: simplexml_load_file(https://resellertest.enom.com/interface.asp?command=check&sld=enom&tld=com&responsetype=xml&uid=youruid&pw=passwordhere): failed to open stream: operation failed in /home/webdesigndavao/public_html/checkdomain.php on line 26

Warning: simplexml_load_file(): I/O warning : failed to load external entity "https://resellertest.enom.com/interface.asp?command=check&sld=enom&tld=com&responsetype=xml&uid=youruid&pw=passwordhere" in /home/webdesigndavao/public_html/checkdomain.php on line 26
bool(false)

1 个答案:

答案 0 :(得分:1)

将OPENSSL版本从0.9.8更新到1.0.0解决了我的问题。感谢