0

I'm using phpwhois php class to find whois details of web domains (http://sourceforge.net/projects/phpwhois/) and i'm using this script on my localhost. When i run this script using below code it shows an error. Please tell me where i am going wrong

Code

<?php
include('whois/whois.main.php');

$whois = new Whois();
$query = 'google.com';
$result = $whois->Lookup($query,false);
echo "<pre>";
var_dump($result);
echo "</pre>";
?>
  • And the error is

: Warning: Illegal string offset 'handler' in C:\wamp\www\whois\whois\whois.gtld.php on line 57

Daman
  • 933
  • 1
  • 7
  • 5

2 Answers2

1

The code at line 57 expects $query to be an array having an element 'handler'=>?
But the original query string is passed to that method, hence the illegal offset warning.
In the bug tracker at http://sourceforge.net/tracker/index.php?func=detail&aid=3605711&group_id=31207&atid=401654 a suggestion to fix this is to change

$this->SUBVERSION = sprintf('%s-%s', $query['handler'], $this->HANDLER_VERSION);

to

if (isset($query['handler'])) {
  $handler = $query['handler'];
} else {
  $handler = $query;
}
$this->SUBVERSION = sprintf('%s-%s', $handler, $this->HANDLER_VERSION);

But I haven't found any other occurence of the string SUBVERSION in the project, so I would just make that line a comment for now....

VolkerK
  • 95,432
  • 20
  • 163
  • 226
-1

Removing the line doesn't break anything since the SUBVERSION property isn't referenced anywhere else

reference phpwhois in github