3

I tested the sample php code of enom api in my localhost and it functions properly. However, when I tested it in my web server, it fails. This sample code checks domain availability using enom API. Any idea why this happens is much appreciated. Thanks. I'm new in using 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;
  }

Error:


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)
japhfortin
  • 361
  • 4
  • 6
  • 18
  • What is not working? Any error? – Oscar Gallardo Oct 03 '16 at 02:59
  • I have no reference but I had a similar bug with `file_get_contents()` so I asume this is the same. In my WebServer there was `alow_url_fopen` and `alow_url_include` set to false which denies rexternal requests with `file_get_contents()` I had to do it with `cURL` instead. – Code Spirit Oct 03 '16 at 03:05
  • Hi, sorry, I just updated the question. I added the error – japhfortin Oct 03 '16 at 03:33
  • The given code above was given by the enom API documentation. I'm also thinking to do this by other means or using cURL. – japhfortin Oct 03 '16 at 03:34
  • 2
    Maybe you'll have to check the version of OpenSSL on your server? http://stackoverflow.com/questions/35030756/paypal-ipn-openssl-error14077410ssl-routinesssl23-get-server-hellosslv3-aler – HZS Oct 03 '16 at 04:00
  • 1
    There is nothing wrong with your PHP - it works exactly as expected for me. When I run this script, I get only `Domain not available` so I presume there is something out of date with your `openssl` extension, if in fact you have it installed. To check if it's installed, then you can run `print_r(get_loaded_extensions());` – Jeff Puckett Oct 03 '16 at 04:23
  • Thanks. I think its on my openssl server too. I tried the code on my localhost and it works. However, I am on a shared hosting. Do you think its possible? Thanks. – japhfortin Oct 03 '16 at 05:37
  • Hi @JeffPuckettII, May I ask if you ran the script on a web server? Thanks. – japhfortin Oct 04 '16 at 02:34
  • 1
    @japhfortin yes I am running Apache/2.4.18 (Ubuntu) with PHP 7.0.8 – Jeff Puckett Oct 04 '16 at 02:37

1 Answers1

1

updating the OPENSSL version from 0.9.8 to 1.0.0 fixed my problem. Thanks

japhfortin
  • 361
  • 4
  • 6
  • 18