?
Solved

getting error in whois code

Posted on 2012-08-17
9
Medium Priority
?
408 Views
Last Modified: 2012-09-16
I am getting this error when executing the file:
Notice: Undefined index: registrar in /var/www/vhosts/prowebinteractive.com/httpdocs/whois/cira.whois on line 76

<?
/*
Whois2.php        PHP classes to conduct whois queries

Copyright (C)1999,2000 easyDNS Technologies Inc. & Mark Jeftovic

Maintained by Mark Jeftovic <markjr@easydns.com>

For the most recent version of this package:

http://www.easydns.com/~markjr/whois2/

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

/* cira.whois        1.0        by Mark Jeftovic <markjr@easydns.com>  */
/*		     2.0	David Saez <david@ols.es> */
/*				standarized object model */

if(!defined("__CIRA_HANDLER__")) define("__CIRA_HANDLER__",1);

include_once("generic2.whois");

class cira extends Whois {

function cira($data) {
   $this->result=$this->parse($data);
}

function parse ($data_str) {

$items=array( "owner.organization"  => "Organization:",
              "domain.name"  => "Subdomain:",
              "registrar" => "Registrar:",
              "domain.created" => "Date-Approved:",
              "domain.changed" => "Date-Modified:",
	      "domain.expires" => "Renewal-Date:",
              "domain.desc" => "Description:",
              "admin.name" => "Admin-Name:",
              "admin.address." => "Admin-Postal:",
              "admin.phone" => "Admin-Phone:",
              "admin.email" => "Admin-Mailbox:",
	      "admin.fax" => "Admin-Fax:",	
              "tech.name" => "Tech-Name:",
              "tech.address." => "Tech-Postal:",
              "tech.phone" => "Tech-Phone:",
              "tech.email" => "Tech-Mailbox:",
	      "tech.fax" => "Tech-Fax:",
	      "domain.nserver.0" => "NS1-Hostname:",
	      "domain.nserver.1" => "NS2-Hostname:",
	      "domain.nserver.2" => "NS3-Hostname:",
	      "domain.nserver.3" => "NS4-Hostname:",
	      "domain.nserver.4" => "NS5-Hostname:",
	      "domain.nserver.5" => "NS6-Hostname:",
              "domain.status" => "Status:"
              );

$r["rawdata"]=$data_str["rawdata"];        

$r["regrinfo"]=generic_whois($data_str["rawdata"],$items);

$r["regyinfo"]=array( "referrer"=>"http://www.easydns.ca" );

$r["regyinfo"]["registrar"]=$r["regrinfo"]["registrar"];
unset($r["regrinfo"]["registrar"]);

return($r);
}

}

Open in new window

0
Comment
Question by:prowebinteractiveinc
  • 4
  • 3
  • 2
9 Comments
 
LVL 3

Expert Comment

by:Hav0k
ID: 38307003
Hard to say without seeing what the method "generic_whois" does.
0
 
LVL 3

Expert Comment

by:Hav0k
ID: 38307004
Include the contents of "generic2.whois" for further support.
0
 

Author Comment

by:prowebinteractiveinc
ID: 38307261
<?php
/*
  Generic3.php    PHP functions for parsing whois output

  Copyright (C)2003

  Maintained by Mark Jeftovic <markjr@easydns.com>

  For the most recent version of this package:

  http://www.easydns.com/~markjr/whois2/

  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  as published by the Free Software Foundation; either version 2
  of the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

function generic_whois ( $rawdata, $items )

{
$r="";
$disok=true;

while (list($key,$val)=each($rawdata))
      { if (trim($val)!="") 
           { 
	     if (($val[0]=='%' || $val[0]=='#') && $disok)
                { $r['disclaimer'][]=trim(substr($val,1));
		  $disok=true;
		  continue;
                }
	     
	     $disok=false;
	     reset($items);
	     //$ok=0;

             while (list($field, $match)=each($items)) 
                   {
		     $pos=strpos($val,$match);
                     if ($pos!==false) 
                        { $parts=explode(".",$field);
                          $var="\$r";
                          while (list($fn,$mn)=each($parts))
                                if ($mn=="")
                                     $var=$var."[]";
                                else $var=$var."[\"".$mn."\"]";

			  $itm=trim(substr($val,$pos+strlen($match)));
			  //$itm=addslashes($itm);
                          if ($itm!="")
                              eval($var."=\"".$itm."\";");
                          //$ok=1;
                          break;
                        }
                   }
	     // buggy	
             //if ($ok==0 && $val[0]==" ")
             //    eval($var."=\"".trim($val)."\";");
           }
      }

if (empty($r))
	$r['registered'] = 'no';
else
	$r['registered'] = 'yes';

return $r;
}

Open in new window

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 111

Expert Comment

by:Ray Paseur
ID: 38308424
On line 75 of the first script, please print out the value of $r with this:

var_dump($r);

Post the output of var_dump() here so we can see what's in that variable, thanks.
0
 

Author Comment

by:prowebinteractiveinc
ID: 38310235
array(3) { ["rawdata"]=> array(39) { [0]=> string(34) "Domain name: chefcite.ca" [1]=> string(33) "Domain status: registered" [2]=> string(33) "Creation date: 2012/08/18" [3]=> string(33) "Expiry date: 2013/08/18" [4]=> string(33) "Updated date: 2012/08/18" [5]=> string(0) "" [6]=> string(10) "Registrar:" [7]=> string(37) " Name: Tucows.com Co." [8]=> string(26) " Number: 156" [9]=> string(0) "" [10]=> string(11) "Registrant:" [11]=> string(53) " Name: E-nnovation Entertainment Inc." [12]=> string(0) "" [13]=> string(23) "Administrative contact:" [14]=> string(32) " Name: Andy Caso" [15]=> string(42) " Postal address: 3852 Hotel de Ville" [16]=> string(48) " Montreal QC H2W2G5 Canada" [17]=> string(36) " Phone: +1.5149155833" [18]=> string(8) " Fax:" [19]=> string(52) " Email: domains@prowebinteractive.com" [20]=> string(0) "" [21]=> string(18) "Technical contact:" [22]=> string(44) " Name: Jason Simmons Trudeau" [23]=> string(46) " Postal address: 13331 Boul. Pierrefonds" [24]=> string(51) " Pierrefonds QC H9A1A6 Canada" [25]=> string(36) " Phone: +1.5147943527" [26]=> string(8) " Fax:" [27]=> string(52) " Email: domains@prowebinteractive.com" [28]=> string(0) "" [29]=> string(13) "Name servers:" [30]=> string(29) " ns2.prowebinteractive.com" [31]=> string(29) " ns1.prowebinteractive.com" [32]=> string(0) "" [33]=> string(49) "% WHOIS look-up made at 2012-08-20 00:07:12 (GMT)" [34]=> string(1) "%" [35]=> string(74) "% Use of CIRA's WHOIS service is governed by the Terms of Use in its Legal" [36]=> string(64) "% Notice, available at http://www.cira.ca/legal-notice/?lang=en " [37]=> string(1) "%" [38]=> string(75) "% (c) 2010 Canadian Internet Registration Authority, (http://www.cira.ca/) " } ["regrinfo"]=> array(1) { ["registered"]=> string(2) "no" } ["regyinfo"]=> array(1) { ["referrer"]=> string(21) "http://www.easydns.ca" } }
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 38310270
Apologies... I should have been more specific.  Please change to use this instead...

echo '<pre>';
var_dump($r);

Open in new window

And then post the formatted output in the code snippet.  It will be much easier to read and work with the data that way.

Thanks, ~Ray
0
 

Author Comment

by:prowebinteractiveinc
ID: 38391353
array(3) {
  ["rawdata"]=>
  array(42) {
    [0]=>
    string(43) "Domain name:           prowebinteractive.ca"
    [1]=>
    string(33) "Domain status:         registered"
    [2]=>
    string(33) "Creation date:         2011/02/19"
    [3]=>
    string(33) "Expiry date:           2013/02/19"
    [4]=>
    string(33) "Updated date:          2012/08/11"
    [5]=>
    string(0) ""
    [6]=>
    string(10) "Registrar:"
    [7]=>
    string(37) "    Name:              Tucows.com Co."
    [8]=>
    string(26) "    Number:            156"
    [9]=>
    string(0) ""
    [10]=>
    string(11) "Registrant:"
    [11]=>
    string(45) "    Name:              Prowebinteractive Inc."
    [12]=>
    string(0) ""
    [13]=>
    string(23) "Administrative contact:"
    [14]=>
    string(36) "    Name:              Jason Trudeau"
    [15]=>
    string(41) "    Postal address:    34 Boul. Brunswick"
    [16]=>
    string(32) "                       Suite 104"
    [17]=>
    string(59) "                       Dollard-Des-Ormeaux QC H9B2N8 Canada"
    [18]=>
    string(36) "    Phone:             +1.5147943527"
    [19]=>
    string(8) "    Fax:"
    [20]=>
    string(52) "    Email:             domains@prowebinteractive.com"
    [21]=>
    string(0) ""
    [22]=>
    string(18) "Technical contact:"
    [23]=>
    string(36) "    Name:              Jason Trudeau"
    [24]=>
    string(41) "    Postal address:    34 Boul. Brunswick"
    [25]=>
    string(32) "                       Suite 104"
    [26]=>
    string(59) "                       Dollard-Des-Ormeaux QC H9B2N8 Canada"
    [27]=>
    string(36) "    Phone:             +1.5147943527"
    [28]=>
    string(8) "    Fax:"
    [29]=>
    string(52) "    Email:             domains@prowebinteractive.com"
    [30]=>
    string(0) ""
    [31]=>
    string(13) "Name servers:"
    [32]=>
    string(28) "    ns2.darknighthosting.com"
    [33]=>
    string(21) "    ns23.dnsprive.com"
    [34]=>
    string(21) "    ns24.dnsprive.com"
    [35]=>
    string(0) ""
    [36]=>
    string(49) "% WHOIS look-up made at 2012-09-12 15:09:02 (GMT)"
    [37]=>
    string(1) "%"
    [38]=>
    string(74) "% Use of CIRA's WHOIS service is governed by the Terms of Use in its Legal"
    [39]=>
    string(64) "% Notice, available at http://www.cira.ca/legal-notice/?lang=en "
    [40]=>
    string(1) "%"
    [41]=>
    string(75) "% (c) 2010 Canadian Internet Registration Authority, (http://www.cira.ca/) "
  }
  ["regrinfo"]=>
  array(1) {
    ["registered"]=>
    string(2) "no"
  }
  ["regyinfo"]=>
  array(1) {
    ["referrer"]=>
    string(21) "http://www.easydns.ca"
  }
}
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 38391789
To use the code snippet, please look for the word "code" in the gray bar below the orange "Post a Comment" title.  Click on "code" and you will find two BBCode tags.  Insert the information in between the tags.  It is notably harder to use than the old code snippet feature that we had before the "upgrade" last spring, but it's the best tool for creating and sharing code that EE has left.

Example:

array(3) {
  ["rawdata"]=>
  array(42) {
    [0]=>
    string(43) "Domain name:           prowebinteractive.ca"
    [1]=>
    string(33) "Domain status:         registered"
    [2]=>
    string(33) "Creation date:         2011/02/19"
    [3]=>
    string(33) "Expiry date:           2013/02/19"
    [4]=>
    string(33) "Updated date:          2012/08/11"
    [5]=>
    string(0) ""
    [6]=>
    string(10) "Registrar:"
    [7]=>
    string(37) "    Name:              Tucows.com Co."
    [8]=>
    string(26) "    Number:            156"
    [9]=>
    string(0) ""
    [10]=>
    string(11) "Registrant:"
    [11]=>
    string(45) "    Name:              Prowebinteractive Inc."
    [12]=>
    string(0) ""
    [13]=>
    string(23) "Administrative contact:"
    [14]=>
    string(36) "    Name:              Jason Trudeau"
    [15]=>
    string(41) "    Postal address:    34 Boul. Brunswick"
    [16]=>
    string(32) "                       Suite 104"
    [17]=>
    string(59) "                       Dollard-Des-Ormeaux QC H9B2N8 Canada"
    [18]=>
    string(36) "    Phone:             +1.5147943527"
    [19]=>
    string(8) "    Fax:"
    [20]=>
    string(52) "    Email:             domains@prowebinteractive.com"
    [21]=>
    string(0) ""
    [22]=>
    string(18) "Technical contact:"
    [23]=>
    string(36) "    Name:              Jason Trudeau"
    [24]=>
    string(41) "    Postal address:    34 Boul. Brunswick"
    [25]=>
    string(32) "                       Suite 104"
    [26]=>
    string(59) "                       Dollard-Des-Ormeaux QC H9B2N8 Canada"
    [27]=>
    string(36) "    Phone:             +1.5147943527"
    [28]=>
    string(8) "    Fax:"
    [29]=>
    string(52) "    Email:             domains@prowebinteractive.com"
    [30]=>
    string(0) ""
    [31]=>
    string(13) "Name servers:"
    [32]=>
    string(28) "    ns2.darknighthosting.com"
    [33]=>
    string(21) "    ns23.dnsprive.com"
    [34]=>
    string(21) "    ns24.dnsprive.com"
    [35]=>
    string(0) ""
    [36]=>
    string(49) "% WHOIS look-up made at 2012-09-12 15:09:02 (GMT)"
    [37]=>
    string(1) "%"
    [38]=>
    string(74) "% Use of CIRA's WHOIS service is governed by the Terms of Use in its Legal"
    [39]=>
    string(64) "% Notice, available at http://www.cira.ca/legal-notice/?lang=en "
    [40]=>
    string(1) "%"
    [41]=>
    string(75) "% (c) 2010 Canadian Internet Registration Authority, (http://www.cira.ca/) "
  }
  ["regrinfo"]=>
  array(1) {
    ["registered"]=>
    string(2) "no"
  }
  ["regyinfo"]=>
  array(1) {
    ["referrer"]=>
    string(21) "http://www.easydns.ca"
  }
}

Open in new window

0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 38391825
Looking at this (line 76) from the original script...

$r["regyinfo"]["registrar"]=$r["regrinfo"]["registrar"];

That tells us that $r is a multidimensional array.  The regyinfo index points to an array, and in that array we have an index named registrar.  Inside the $r array, there is another "sub-array" if you will, pointed to by the index named regrinfo.  Inside this latter sub-array, the index registrar is undefined.

You can use var_dump() to print out the contents of these variables.  Once you see what the variables contain, it will be easier to debug the code.

HTH, ~Ray
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month13 days, 12 hours left to enroll

755 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question