I'm looping through rows in my database to get information from whois results.
Here's what I have right now:
function GetEmailFromWhois($domain){ $whois = new Whois(); $query = $domain; $whois->deep_whois=TRUE; $result = $whois->Lookup($query, false); $raw_data = $result["rawdata"]; $email = ""; foreach($raw_data as $item){ $items = explode(":",$item); if($items[0] == "Registrant Email"){ $email = $items[1]; } } return $email;}
The code above gets the Registrant Email
from the whois results.
I reference it later on in my code like this: $email = GetEmailFromWhois($domain);
However, at the same time as getting the registrant email, I'd also like to get the Registrant Name
, Registrant Phone
, and Registrant Country
.
I could just copy the code above 3 more times for each of those additional fields, but that would cause there to be 4 whois queries for each domain - instead of just one.
Anyone know how I can get the info I need in a single query and then use it later on in my code?