2016-07-18 57 views
-1

我想從我的CodeIgniter控制器調用WHOIS域查找服務,並且需要返回數組輸出。我剛剛與WHOIS支持團隊討論過,他們表示他們不提供API調用。你有什麼想法如何做到這一點?在CodeIgniter中獲取whois輸出

+0

試試這個API http://freedomainapi.com/free-whois-api.html –

+0

感謝您的回覆。其實我得到了解決方案。 – Harjinder

+2

因此,如果您有解決方案,請更新您的問題或發佈答案 – moped

回答

0
I Got Best way to call WHOIS domain lockup services 

<?php 
    $username="username"; 
    $password="password"; 
    $contents = file_get_contents("http://www.whoisxmlapi.com//whoisserver/WhoisService?domainName=google.com&username=$username&password=$password&outputFormat=JSON"); 
    //echo $contents; 
    $res=json_decode($contents); 
    if($res){ 
    if($res->ErrorMessage){ 
     echo $res->ErrorMessage->msg; 
    } 
    else{ 
     $whoisRecord = $res->WhoisRecord; 
     if($whoisRecord){ 
      echo "Domain name: " . print_r($whoisRecord->domainName,1) ."<br/>"; 
      echo "Created date: " .print_r($whoisRecord->createdDate,1) ."<br/>"; 
      echo "Updated date: " .print_r($whoisRecord->updatedDate,1) ."<br/>"; 
      if($whoisRecord->registrant)echo "Registrant: <br/><pre>" . print_r($whoisRecord->registrant->rawText, 1) ."</pre>"; 
      //print_r($whoisRecord); 
     } 
    } 
    } 

?>