phpWhois.org/example.php

136 lines
3.4 KiB
PHP
Raw Normal View History

2005-08-29 11:07:12 +00:00
<?php
2005-07-27 09:57:53 +00:00
/*
Whois.php PHP classes to conduct whois queries
2005-07-16 15:32:07 +00:00
2005-07-27 09:57:53 +00:00
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:
2005-08-31 15:26:22 +00:00
http://www.phpwhois.org
2005-07-27 09:57:53 +00:00
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.
2005-08-26 06:46:49 +00:00
*/
2005-08-29 11:07:12 +00:00
?>
2006-03-19 08:24:18 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
2005-08-29 11:07:12 +00:00
<head>
<title>whois.php -base classes to do whois queries with php</title>
</head>
2006-03-19 08:24:18 +00:00
<body bgcolor="white">
2005-08-29 11:07:12 +00:00
2006-03-19 08:24:18 +00:00
<?
if(isSet($_GET['query']))
2005-08-29 11:07:12 +00:00
{
$query = $_GET['query'];
2006-03-19 08:24:18 +00:00
if (!empty($_GET['output']))
$output = $_GET['output'];
else
$output = '';
2005-08-29 11:07:12 +00:00
include_once('whois.main.php');
include_once('whois.utils.php');
2005-08-29 11:07:12 +00:00
$whois = new Whois();
2006-03-19 08:43:31 +00:00
// uncomment the following line to get faster but less acurate results
// $whois->deep_whois = false;
// To use special whois servers (see README)
2006-03-19 08:24:18 +00:00
//$whois->UseServer('uk','whois.nic.uk:1043?{hname} {ip} {query}');
//$whois->UseServer('au','whois-check.ausregistry.net.au');
// uncomment the following line to add support for non ICANN tld's
// $whois->non_icann = true;
2005-08-29 11:07:12 +00:00
$result = $whois->Lookup($query);
2006-03-20 16:40:56 +00:00
echo "<blockquote><b>Results for $query :</b><br></br>";
2005-08-29 11:07:12 +00:00
switch ($output)
{
case 'object':
2005-09-05 15:24:03 +00:00
if ($whois->Query['status'] < 0)
{
2006-03-19 08:24:18 +00:00
echo implode($whois->Query['errstr'],"\n<br></br>");
2005-09-05 15:24:03 +00:00
}
else
{
$utils = new utils;
echo $utils->showObject($result);
}
break;
case 'nice':
2006-03-19 08:24:18 +00:00
if (!empty($result['rawdata'])) {
$utils = new utils;
2005-08-31 15:26:22 +00:00
echo $utils->showHTML($result);
}
else {
2006-03-19 08:24:18 +00:00
echo implode($whois->Query['errstr'],"\n<br></br>");
}
break;
default:
if(!empty($result['rawdata'])) {
2006-03-19 08:24:18 +00:00
echo '<pre>'.implode($result['rawdata'],"\n").'</pre>';
}
else {
2006-03-19 08:24:18 +00:00
echo implode($whois->Query['errstr'],"\n<br></br>");
}
2005-08-29 11:07:12 +00:00
}
2006-03-20 16:40:56 +00:00
echo '</blockquote>';
2005-08-29 11:07:12 +00:00
}
?>
<center>
<table>
2006-03-19 08:24:18 +00:00
<tr><td bgcolor="#55aaff">
<form method="get" action="<?echo $_SERVER['PHP_SELF']; ?>">
2005-08-29 11:07:12 +00:00
<table>
<tr><td colspan=2>
<center>
2006-03-19 08:24:18 +00:00
<b>Enter any domain name, ip address or AS handle you would like to query whois for</b>
<br></br><br></br>
<input name="query"></input> <input type="submit" value="Whois"></input>
</center>
2005-08-29 11:07:12 +00:00
</td></tr>
2005-08-29 11:07:12 +00:00
<tr><td>
2006-03-19 08:24:18 +00:00
<input type="radio" name="output" value="normal"></input> Show me regular output
<br></br>
<input type="radio" name="output" value="nice" checked></input> Show me HTMLized output
<br></br>
<input type="radio" name="output" value="object"></input> Show me the returned PHP object
2005-08-29 11:07:12 +00:00
</td>
2005-08-29 11:07:12 +00:00
<td align=right valign=bottom>
<a href="http://phpwhois.sourceforge.net">
2006-03-19 08:24:18 +00:00
<img border=0 src="whois.icon.png" alt=""></img><br></br>
2005-08-29 11:07:12 +00:00
</a>
</td>
</tr>
</table>
</form>
</td></tr>
</table>
</center>
2006-04-08 06:48:01 +00:00
</body>
</html>