Link to home
Start Free TrialLog in
Avatar of prowebinteractiveinc
prowebinteractiveinc

asked on

getting error in whois code

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

Avatar of Hav0k
Hav0k
Flag of Finland image

Hard to say without seeing what the method "generic_whois" does.
Include the contents of "generic2.whois" for further support.
Avatar of prowebinteractiveinc
prowebinteractiveinc

ASKER

<?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

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.
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" } }
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
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"
  }
}
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

ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial