File: test17476.php

package info (click to toggle)
php-net-whois 1.0.5-3.2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 108 kB
  • sloc: php: 244; xml: 166; makefile: 2
file content (41 lines) | stat: -rw-r--r-- 886 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/**
 * test17476.php
 * 09-Jun-2010
 *
 * PHP Version 5
 *
 * @category test17476
 * @package  test17476
 * @author   Ken Guest <ken.guest@blacknight.com>
 * @license  GPL (see http://www.gnu.org/licenses/gpl.txt)
 * @version  CVS: <cvs_id>
 * @link     test17476.php
 * @todo
*/



?>
<?php
$q=isset($_REQUEST['q'])?htmlspecialchars($_REQUEST['q']):NULL;
$s=isset($_REQUEST['s'])?htmlspecialchars($_REQUEST['s']):NULL;
$q = 'test.com';
if (strchr($q,'.')) {
    require_once "Net/Whois.php";
    $whois = new Net_Whois;
    $q=strtolower($q);
    if (!$s && $q[0] == '.') {
        $s='whois.iana.org';
    }
    $q=trim($q,'.');
    $tld=pathinfo($q,PATHINFO_EXTENSION);
    if ($tld=='com') {
        $whois->setAuthoritative(1);
    } elseif ($tld=='name') {
        $q='domain = '.$q;
    }
    $data=htmlspecialchars($whois->query($q,$s));
    echo "<pre>$data</pre>";
}
?>