Ciphertel
asked on
PHP whois array results problem
the below code returns my array ok but for some reason i cannot get the nameservers from the array.
i must be missing something simple, any suggestions ?
The result from the search is as below
[QUOTE]
Array
(
[regyinfo] => Array
(
[referrer] => http://www.aunic.net
[registrar] => AU-NIC
[servers] => Array
(
[0] => Array
(
[server] => whois.aunic.net
[args] => johnsons.net.au
[port] => 43
)
)
[type] => domain
)
[regrinfo] => Array
(
[domain] => Array
(
[name] => johnsons.net.au
[changed] => 2008-06-30
[sponsor] => Melbourne IT
[status] => ok
[nserver] => Array
(
[ns1.johnsons.net.au] => 0.0.0.0
[ns2.johnsons.net.au] => 0.0.0.0
)
)
[owner] => Array
(
[organization] => Johnsons
[handle] => OTHER N/A
[name] => Tracey Johnson
)
[registered] => yes
)
[rawdata] => Array
(
[0] => Domain Name: johnsons.net.au
[1] => Last Modified: 30-Jun-2008 08:16:12 UTC
[2] => Registrar ID: Melbourne IT
[3] => Registrar Name: Melbourne IT
[4] => Status: ok
[5] =>
[6] => Registrant: Johnsons Gateway
[7] => Registrant ID: OTHER N/A
[8] => Eligibility Type: Other
[9] => Eligibility Name: Johnsons Internet Services
[10] =>
[11] => Registrant Contact ID: Z110566996728342
[12] => Registrant Contact Name: Tracey Johnson
[13] => Registrant Contact Email: Visit whois.ausregistry.com.au for Web based WhoIs
[14] =>
[15] => Tech Contact ID: Z110566996728342
[16] => Tech Contact Name: Tracey Johnson
[17] => Tech Contact Email: Visit whois.ausregistry.com.au for Web based WhoIs
[18] =>
[19] => Name Server: ns1.johnsons.net.au
[20] => Name Server IP: 0.0.0.0
[21] => Name Server: ns2.johnsons.net.au
[22] => Name Server IP: 0.0.0.0
)
)
[/QUOTE]
//details changed for security
i must be missing something simple, any suggestions ?
The result from the search is as below
[QUOTE]
Array
(
[regyinfo] => Array
(
[referrer] => http://www.aunic.net
[registrar] => AU-NIC
[servers] => Array
(
[0] => Array
(
[server] => whois.aunic.net
[args] => johnsons.net.au
[port] => 43
)
)
[type] => domain
)
[regrinfo] => Array
(
[domain] => Array
(
[name] => johnsons.net.au
[changed] => 2008-06-30
[sponsor] => Melbourne IT
[status] => ok
[nserver] => Array
(
[ns1.johnsons.net.au] => 0.0.0.0
[ns2.johnsons.net.au] => 0.0.0.0
)
)
[owner] => Array
(
[organization] => Johnsons
[handle] => OTHER N/A
[name] => Tracey Johnson
)
[registered] => yes
)
[rawdata] => Array
(
[0] => Domain Name: johnsons.net.au
[1] => Last Modified: 30-Jun-2008 08:16:12 UTC
[2] => Registrar ID: Melbourne IT
[3] => Registrar Name: Melbourne IT
[4] => Status: ok
[5] =>
[6] => Registrant: Johnsons Gateway
[7] => Registrant ID: OTHER N/A
[8] => Eligibility Type: Other
[9] => Eligibility Name: Johnsons Internet Services
[10] =>
[11] => Registrant Contact ID: Z110566996728342
[12] => Registrant Contact Name: Tracey Johnson
[13] => Registrant Contact Email: Visit whois.ausregistry.com.au for Web based WhoIs
[14] =>
[15] => Tech Contact ID: Z110566996728342
[16] => Tech Contact Name: Tracey Johnson
[17] => Tech Contact Email: Visit whois.ausregistry.com.au for Web based WhoIs
[18] =>
[19] => Name Server: ns1.johnsons.net.au
[20] => Name Server IP: 0.0.0.0
[21] => Name Server: ns2.johnsons.net.au
[22] => Name Server IP: 0.0.0.0
)
)
[/QUOTE]
//details changed for security
include ("./phpwhois-4.1.3/whois.main.php");
$whois = new Whois();
$result = $whois->Lookup($domain_check);
$registrar = $result['regrinfo']['domain']['sponsor'];
$nameserver1 = $result['regrinfo']['domain']['nserver'][0];
$nameserver2 = $result['regrinfo']['domain']['nserver'][1];
$status = $result['regrinfo']['domain']['status'];
$owner = $result['regrinfo']['owner']['name'];
ASKER
My understanding was the data was already formatted into an array and all i had to do was reference this directly
is a key of array ns1.johnsons.net.au
for sample:
$nameserver1 = $result['regrinfo']['domai n']['nserv er'][ns1.j ohnsons.ne t.au];
$nameserver1 will be get the ip not the key name
if you use array_keys($result['regrin fo']['doma in']['nser ver'])
you get an array of keys
for sample:
$nameserver1 = $result['regrinfo']['domai
$nameserver1 will be get the ip not the key name
if you use array_keys($result['regrin
you get an array of keys
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ahh of course now i understand, thank you very much.
now i just need to work out a way to query the 'A" and 'MX' records as well.
Cheers
now i just need to work out a way to query the 'A" and 'MX' records as well.
Cheers
your welcome
thanks for the points
thanks for the points
$nameserver1 = $result['regrinfo']['domai
but i think the key is variable and you most to parse the results in other array to get the results.
Open in new window