2016-10-03 27 views
3

我在本地主機上測試了enom api的示例php代碼,它的功能正常。但是,當我在我的Web服務器中測試它時,它會失敗。此示例代碼使用enom API檢查域的可用性。 任何想法爲什麼發生這種情況非常感謝。謝謝。我是使用enom API的新手。使用PHP中的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) 
+0

什麼不工作?任何錯誤? –

+0

我沒有參考,但我有'file_get_contents()'類似的錯誤,所以我認爲這是相同的。在我的WebServer中,有'alow_url_fopen'和'alow_url_include'設置爲false,它拒絕使用'file_get_contents()'的重新請求''我必須使用'cURL'來代替。 –

+0

嗨,對不起,我剛更新了這個問題。我添加了錯誤 – japhfortin

回答

1

從更新的0.9.8版本OPENSSL 1.0.0固定我的問題。謝謝