added support & handler for .org.za, added handler for .co.za

This commit is contained in:
sparc 2008-04-29 17:16:34 +00:00
parent 40b392f87d
commit e583589894
10 changed files with 231 additions and 60 deletions

View file

@ -1,5 +1,16 @@
2008/05/05
2008/04/28
- whois.za.php renamed to whois.zanet.php
- added support & handler for .org.za
- added handler for .co.za
- minor improvemts on whois.client.php to allow
handlers for second level domains
- improved nameserver detection
2008/03/05
- dotregistrar is now part of dotster
- fixes in date parser
- .cz handler update
- fixed .ch whois server detection
2007/12/21
- fixed uninitialized variable in example.php

View file

@ -416,23 +416,26 @@ class WhoisClient {
*/
function Process (&$result, $deep_whois=true) {
$handler_name = str_replace('.','_',$this->Query['handler']);
// If the handler has not already been included somehow, include it now
$HANDLER_FLAG = sprintf("__%s_HANDLER__", strtoupper($this->Query['handler']));
$HANDLER_FLAG = sprintf("__%s_HANDLER__", strtoupper($handler_name));
if (!defined($HANDLER_FLAG))
include($this->Query['file']);
// If the handler has still not been included, append to query errors list and return
if(!defined($HANDLER_FLAG)) {
if (!defined($HANDLER_FLAG))
{
$this->Query['errstr'][] = "Can't find ".$this->Query['tld'].' handler: '.$this->Query['file'];
return($result);
}
if (!$this->gtld_recurse && $this->Query['file']=='whois.gtld.php')
if (!$this->gtld_recurse && $this->Query['file'] == 'whois.gtld.php')
return $result;
// Pass result to handler
$object = $this->Query['handler'].'_handler';
$object = $handler_name.'_handler';
$handler = new $object('');

75
src/whois.co.za.php Normal file
View file

@ -0,0 +1,75 @@
<?php
/*
Whois.php PHP classes to conduct whois queries
Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
Maintained by David Saez (david@ols.es)
For the most recent version of this package visit:
http://www.phpwhois.org
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.
*/
if (!defined('__CO_ZA_HANDLER__'))
define('__CO_ZA_HANDLER__', 1);
require_once('whois.parser.php');
class co_Za_handler
{
function parse($data_str, $query)
{
$items = array(
'0a. lastupdate :' => 'domain.changed',
'1a. domain :' => 'domain.name',
'2b. registrantpostaladdress:' => 'owner.address.address.0',
'2f. billingaccount :' => 'billing.name',
'2g. billingemail :' => 'billing.email',
'2i. invoiceaddress :' => 'billing.address',
'2j. registrantphone :' => 'owner.phone',
'2k. registrantfax :' => 'owner.fax',
'2l. registrantemail :' => 'owner.email',
'4a. admin :' => 'admin.name',
'4c. admincompany :' => 'admin.organization',
'4d. adminpostaladdr :' => 'admin.address',
'4e. adminphone :' => 'admin.phone',
'4f. adminfax :' => 'admin.fax',
'4g. adminemail :' => 'admin.email',
'5a. tec :' => 'tech.name',
'5c. teccompany :' => 'tech.organization',
'5d. tecpostaladdr :' => 'tech.address',
'5e. tecphone :' => 'tech.phone',
'5f. tecfax :' => 'tech.fax',
'5g. tecemail :' => 'tech.email',
'6a. primnsfqdn :' => 'domain.nserver.0',
'6e. secns1fqdn :' => 'domain.nserver.1',
'6i. secns2fqdn :' => 'domain.nserver.2',
'6m. secns3fqdn :' => 'domain.nserver.3',
'6q. secns4fqdn :' => 'domain.nserver.4'
);
$r['regrinfo'] = generic_parser_b($data_str['rawdata'], $items);
$r['regyinfo']['referrer'] = 'http://www.co.za';
$r['regyinfo']['registrar'] = 'UniForum Association';
return ($r);
}
}
?>

View file

@ -123,7 +123,7 @@ class Whois extends WhoisClient
$tld = '';
$server = '';
$dp = explode('.', $domain);
$np = count($dp) - 1;
$np = count($dp)-1;
$tldtests = array();
for ($i = 0; $i < $np; $i++)
@ -301,34 +301,37 @@ class Whois extends WhoisClient
while (list($key, $val) = each($nserver))
{
$val = str_replace('[', '', trim($val));
$val = str_replace(']', '', $val);
$val = str_replace( array('[',']','(',')'), '', trim($val));
$val = str_replace("\t", ' ', $val);
$parts = explode(' ', $val);
$host = '';
$ip = '';
while (list($k, $p) = each($parts))
foreach($parts as $p)
{
if ($p == '')
continue;
if ((ip2long($p) == - 1) or (ip2long($p) === false))
{
if ($host == '')
$host = $p;
// Hostname ?
if (strpos($p,'.')) $host = $p;
}
else
// IP Address
$ip = $p;
}
// Valid host name ?
if ($host == '') continue;
// Get ip address
if ($ip == '')
{
$ip = gethostbyname($host);
if ($ip == $host)
$ip = '(DOES NOT EXIST)';
if ($ip == $host) $ip = '(DOES NOT EXIST)';
}
if (substr($host,-1,1) == '.')
$host = substr($host,0,-1);
if (substr($host,-1,1) == '.') $host = substr($host,0,-1);
$dns[strtolower($host)] = $ip;
}

72
src/whois.org.za.php Normal file
View file

@ -0,0 +1,72 @@
<?php
/*
Whois.php PHP classes to conduct whois queries
Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
Maintained by David Saez (david@ols.es)
For the most recent version of this package visit:
http://www.phpwhois.org
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.
*/
require_once('whois.parser.php');
if (!defined('__ORG_ZA_HANDLER__'))
define('__ORG_ZA_HANDLER__', 1);
class org_za_handler
{
function parse($data, $query)
{
$items = array(
'domain.status' => 'Status:',
'domain.nserver' => 'Domain name servers in listed order:',
'domain.updated' => 'Record last updated on',
'owner' => "rwhois search on 'sex.org.za':",
'admin' => 'Administrative Contact:',
'tech' => 'Technical Contact:',
'billing' => 'Billing Contact:',
'#' => 'Search Again'
);
$r['regrinfo'] = get_blocks($data['rawdata'], $items);
if (isset($r['regrinfo']['domain']['status']))
{
$r['regrinfo']['registered'] = 'yes';
$r['regrinfo']['domain']['handler'] = strtok(array_shift($r['regrinfo']['owner']),' ');
$r['regrinfo']['owner'] = get_contact($r['regrinfo']['owner']);
$r['regrinfo']['admin'] = get_contact($r['regrinfo']['admin']);
$r['regrinfo']['tech'] = get_contact($r['regrinfo']['tech']);
$r['regrinfo']['billing'] = get_contact($r['regrinfo']['billing']);
}
else
$r['regrinfo']['registered'] = 'no';
$r['regyinfo']['referrer'] = 'http://www.org.za';
$r['regyinfo']['registrar'] = 'The ORG.ZA Domain';
$r['rawdata'] = $data['rawdata'];
return ($r);
}
}
?>

View file

@ -344,6 +344,7 @@ $items = array (
'(fax)' => 'fax',
'fax' => 'fax',
'tel.' => 'phone',
'tel:' => 'phone',
'phone::' => 'phone',
'phone:' => 'phone',
'phone-' => 'phone',

View file

@ -38,8 +38,8 @@ $this->DATA = array(
'li' => 'ch',
'net' => 'gtld',
'tv' => 'gtld',
'za.org' => 'za',
'za.net' => 'za'
'za.org' => 'zanet',
'za.net' => 'zanet'
);
/* If whois Server needs any parameters, enter it here */
@ -55,7 +55,6 @@ $this->WHOIS_PARAM = array(
$this->WHOIS_SPECIAL = array(
'ad' => '',
'ae' => 'whois.nic.ae',
'ae.com' => 'whois.centralnic.net',
'af' => 'whois.nic.af',
'ai' => 'http://whois.offshore.ai/cgi-bin/whois.pl?domain-name={domain}.ai',
'al' => '',
@ -65,51 +64,53 @@ $this->WHOIS_SPECIAL = array(
'bg' => 'http://www.register.bg/bg-nic/displaydomain.pl?domain={domain}.bg&search=exist',
'bi' => 'whois.nic.bi',
'bj' => 'whois.nic.bj',
'br.com' => 'whois.centralnic.net',
'by' => '',
'bz' => 'whois2.afilias-grs.net',
'ch' => 'whois.nic.ch',
'cn.com' => 'whois.centralnic.net',
'co.za' => 'http://co.za/cgi-bin/whois.sh?Domain={domain}.co.za',
'cy' => '',
'de.com' => 'whois.centralnic.net',
'es' => 'http://www.neodigit.es/dominios/whois.php?dom={domain}.es',
'eu.com' => 'whois.centralnic.net',
'fm' => 'http://www.dot.fm/query_whois.cfm?domain={domain}&tld=fm',
'hu.com' => 'whois.centralnic.net',
'jobs' => 'jobswhois.verisign-grs.com',
'jpn.com' => 'whois.centralnic.net',
'kr.com' => 'whois.centralnic.net',
'la' => 'whois.centralnic.net',
'gb.com' => 'whois.centralnic.net',
'gb.net' => 'whois.centralnic.net',
'gr' => '',
'gs' => 'http://www.adamsnames.tc/whois/?domain={domain}.gs',
'mobi' => 'whois.dotmobiregistry.net',
'ms' => 'http://www.adamsnames.tc/whois/?domain={domain}.ms',
'mt' => 'http://www.um.edu.mt/cgi-bin/nic/whois?domain={domain}.mt',
'net.au' => 'whois.aunic.net',
'no.com' => 'whois.centralnic.net',
'pe' => 'http://nic.pe/detpublic.php?decid=B&ndom={domain}.pe',
'pr' => 'whois.uprr.pr',
'pro' => 'whois.registry.pro',
'qc.com' => 'whois.centralnic.net',
'ru.com' => 'whois.centralnic.net',
'sa.com' => 'whois.centralnic.net',
'sc' => 'whois2.afilias-grs.net',
'se.com' => 'whois.centralnic.net',
'se.net' => 'whois.centralnic.net',
'tc' => 'http://www.adamsnames.tc/whois/?domain={domain}.tc',
'tf' => 'http://www.adamsnames.tc/whois/?domain={domain}.tf',
'travel' => 'http://www.whois.travel/whois.cgi?TLD=travel&dn={domain}&TYPE=DOMAIN',
'vg' => 'http://www.adamsnames.tc/whois/?domain={domain}.vg',
// Second level
'net.au' => 'whois.aunic.net',
'ae.com' => 'whois.centralnic.net',
'br.com' => 'whois.centralnic.net',
'cn.com' => 'whois.centralnic.net',
'de.com' => 'whois.centralnic.net',
'eu.com' => 'whois.centralnic.net',
'hu.com' => 'whois.centralnic.net',
'jpn.com'=> 'whois.centralnic.net',
'kr.com' => 'whois.centralnic.net',
'gb.com' => 'whois.centralnic.net',
'no.com' => 'whois.centralnic.net',
'qc.com' => 'whois.centralnic.net',
'ru.com' => 'whois.centralnic.net',
'sa.com' => 'whois.centralnic.net',
'se.com' => 'whois.centralnic.net',
'za.com' => 'whois.centralnic.net',
'uk.com' => 'whois.centralnic.net',
'uk.net' => 'whois.centralnic.net',
'us.com' => 'whois.centralnic.net',
'uy.com' => 'whois.centralnic.net',
'vg' => 'http://www.adamsnames.tc/whois/?domain={domain}.vg',
'za.com' => 'whois.centralnic.net',
'gb.net' => 'whois.centralnic.net',
'se.net' => 'whois.centralnic.net',
'uk.net' => 'whois.centralnic.net',
'za.net' => 'whois.za.net',
'za.org' => 'whois.za.net'
'za.org' => 'whois.za.net',
'co.za' => 'http://co.za/cgi-bin/whois.sh?Domain={domain}.co.za',
'org.za' => 'http://www.org.za/cgi-bin/rwhois?domain={domain}.org.za&format=full'
);
/* handled gTLD whois servers */

View file

@ -27,12 +27,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/* zanic.whois 1.0 Brett Cave, based on code by David Saez */
if (!defined('__ZA_HANDLER__'))
define('__ZA_HANDLER__', 1);
if (!defined('__ZANET_HANDLER__'))
define('__ZANET_HANDLER__', 1);
require_once('whois.parser.php');
class za_handler
class zanet_handler
{
function parse($data_str, $query)
@ -78,7 +78,10 @@ class za_handler
}
else
{
if (isset($r['regrinfo']['admin']))
$r['regrinfo']['admin'] = get_contact($r['regrinfo']['admin']);
if (isset($r['regrinfo']['tech']))
$r['regrinfo']['tech'] = get_contact($r['regrinfo']['tech']);
}

View file

@ -32,6 +32,8 @@ se nic-se.se
uk olsns.co.uk
us neustar.us
ws samoanic.ws informe.ws
.co.za sex.co.za
.org.za sex.org.za
// .com/.net/.tv/.jobs

File diff suppressed because one or more lines are too long