在 CodeIgniter 中获取 whois 输出

Get whois output in CodeIgniter

我想从我的 CodeIgniter 控制器调用 WHOIS 域查找服务并需要 return 数组输出。我刚刚与 WHOIS 支持团队讨论过,他们说他们不提供 API 调用。你知道怎么做吗?

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);
        }
    }
  }

?>