nainil
asked on
Need to parse value from PHP Array
When I use the code mentioned below it returns the values in an array.
From the array I need to find the value "expires" only and echo it. How can I do that?
So it should echo something like:
Domain: example.com Expires on "2011-05-04"
Can someone help me with it please?
<?php
include('whois.main.php');
$whois = new Whois();
$query = 'example.com';
$result = $whois->Lookup($query,false);
echo "<pre>";
print_r($result);
echo "</pre>";
?>
Array
(
[regrinfo] => Array
(
[domain] => Array
(
[name] => example.com
[nserver] => Array
(
[ns1.hitfarm.com] => 72.51.27.54
[ns2.hitfarm.com] => 208.87.33.160
)
[status] => Array
(
[0] => clientTransferProhibited
)
[changed] => 2010-06-30
[created] => 2005-05-04
[expires] => 2011-05-04
)
[registered] => yes
)
[regyinfo] => Array
(
[registrar] => NAMEVIEW, INC.
[whois] => whois.nameview.com
[referrer] => http://www.nameview.com
[servers] => Array
(
[0] => Array
(
[server] => com.whois-servers.net
[args] => domain =monil.com
[port] => 43
)
)
[type] => domain
)
[rawdata] => Array
(
[0] =>
[1] => Whois Server Version 2.0
[2] =>
[3] => Domain names in the .com and .net domains can now be registered
[4] => with many different competing registrars. Go to http://www.internic.net
[5] => for detailed information.
[6] =>
[7] => Domain Name: EXAMPLE.COM
[8] => Registrar: NAMEVIEW, INC.
[9] => Whois Server: whois.nameview.com
[10] => Referral URL: http://www.nameview.com
[11] => Name Server: NS1.HITFARM.COM
[12] => Name Server: NS2.HITFARM.COM
[13] => Status: clientTransferProhibited
[14] => Updated Date: 30-jun-2010
[15] => Creation Date: 04-may-2005
[16] => Expiration Date: 04-may-2011
[17] =>
[18] => >>> Last update of whois database: Fri, 02 Jul 2010 17:38:18 UTC <<<
[19] =>
[20] => NOTICE: The expiration date displayed in this record is the date the
[21] => registrar's sponsorship of the domain name registration in the registry is
[22] => currently set to expire. This date does not necessarily reflect the expiration
[23] => date of the domain name registrant's agreement with the sponsoring
[24] => registrar. Users may consult the sponsoring registrar's Whois database to
[25] => view the registrar's reported date of expiration for this registration.
[26] =>
[27] => TERMS OF USE: You are not authorized to access or query our Whois
[28] => database through the use of electronic processes that are high-volume and
[29] => automated except as reasonably necessary to register domain names or
[30] => modify existing registrations; the Data in VeriSign Global Registry
[31] => Services' ("VeriSign") Whois database is provided by VeriSign for
[32] => information purposes only, and to assist persons in obtaining information
[33] => about or related to a domain name registration record. VeriSign does not
[34] => guarantee its accuracy. By submitting a Whois query, you agree to abide
[35] => by the following terms of use: You agree that you may use this Data only
[36] => for lawful purposes and that under no circumstances will you use this Data
[37] => to: (1) allow, enable, or otherwise support the transmission of mass
[38] => unsolicited, commercial advertising or solicitations via e-mail, telephone,
[39] => or facsimile; or (2) enable high volume, automated, electronic processes
[40] => that apply to VeriSign (or its computer systems). The compilation,
[41] => repackaging, dissemination or other use of this Data is expressly
[42] => prohibited without the prior written consent of VeriSign. You agree not to
[43] => use electronic processes that are automated and high-volume to access or
[44] => query the Whois database except as reasonably necessary to register
[45] => domain names or modify existing registrations. VeriSign reserves the right
[46] => to restrict your access to the Whois database in its sole discretion to ensure
[47] => operational stability. VeriSign may restrict or terminate your access to the
[48] => Whois database for failure to abide by these terms of use. VeriSign
[49] => reserves the right to modify these terms at any time.
[50] =>
[51] => The Registry database contains ONLY .COM, .NET, .EDU domains and
[52] => Registrars.
)
)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry.. but how do I echo the name servers also? I need NameServer 1 & NameServer 2.
I need these seperately echoed like:
Name server 1 = [ns1.hitfarm.com] => 72.51.27.54
Name server 2 = [ns2.hitfarm.com] => 208.87.33.160
I need these seperately echoed like:
Name server 1 = [ns1.hitfarm.com] => 72.51.27.54
Name server 2 = [ns2.hitfarm.com] => 208.87.33.160
ASKER