Jump to content

Simple Array not working ! Very Strange


ankur0101

Recommended Posts

Hi,

I am performing some whois query using phpwois.

http://www.phpwhois.org/

 

 

So after doing its object output i.e.

$whois = new Whois();
$result = $whois->Lookup($domain);
$winfo = '';
$utils = new utils;
$winfo = $utils->showHTML($result);


 

 

, I am getting following data for for phpfreaks.com>

regrinfo->Array
domain->Array
  name->phpfreaks.com
  nserver->Array
   ns1.serverpowered.net->204.13.168.4
   ns2.serverpowered.net->216.12.222.4
   ns3.serverpowered.net->66.97.171.74
   ns4.serverpowered.net->66.97.171.254
  status->Locked
  changed->2011-08-29
  created->2001-10-11
  expires->2016-10-11
registered->yes
owner->Array
  name->Web Freaks
  address->Array
   0->Contact Administrative ()
admin->Array
  email->[email protected]
  name->Contact Administrative
  phone->4072751117
  fax->+1.4072757706
  address->Array
   0->Web Freaks
   4->3700 Commerce Blvd
   5->Suite 154
   6->Kissimmee, FL 34741
   7->US
tech->Array
  email->[email protected]
  name->Contact Administrative
  phone->4072751117
  fax->+1.4072757706
  address->Array
   0->Web Freaks
   4->3700 Commerce Blvd
   5->Suite 154
   6->Kissimmee, FL 34741
   7->US
regyinfo->Array
registrar->ENOM, INC.
referrer->http://www.enom.com
servers->Array
  0->Array
   server->com.whois-servers.net
   args->domain =phpfreaks.com
   port->43
  1->Array
   server->whois.enom.com
   args->phpfreaks.com
   port->43
type->domain

 

 

Now I want to show Domain registrar (Enom, INC.)

 

So I did following

 

echo $winfo['regyinfo'];

 

Now above code shows following >>

registrar->ENOM, INC.
referrer->http://www.enom.com
servers->Array
0->Array
  server->com.whois-servers.net
  args->domain =phpfreaks.com
  port->43
1->Array
  server->whois.enom.com
  args->phpfreaks.com
  port->43
type->domain

 

To obtain I mean to show ENOM, INC, I used following >

 

echo $winfo['regyinfo']['registrar'];

But it gave error, so I used following >>

$temp = $winfo['regyinfo'];
echo $temp['registrar'];

 

But it give output as follows :

 

<

 

 

I dont know what wrong I am doing ?

If it is showing regyinfo, then it should also show registrar.

 

Thanks

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/257699-simple-array-not-working-very-strange/
Share on other sites

The only whois utils class I can find has utils::showHTML() returning a string.  I'm betting that the utils class you have does the same, or outputs an object.  If you could post the method utils::showHTML(), it would clear up a lot of questions.

The showHTML method is for displaying the information. It is not an array of data that you access element of. When you do access a non-existent index of a string, it returns the first character of that string.

 

To access elements of the result, AFAIK (I haven't figured out how to actually use that class based on its excellent documentation - edit: found something useful in the readme file) you would just refer to elements within $result.

 

Edit: What does the following show -

 

echo '<pre>',print_r($result, true),'</pre>';

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.