Rev 5 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | daniel-mar | 1 | #!/usr/bin/php |
2 | <?php |
||
3 | |||
4 | # |
||
11 | daniel-mar | 5 | # VGWhoIs (ViaThinkSoft Global WhoIs, a fork of generic Whois / gwhois) |
5 | daniel-mar | 6 | # Subprogram: vu TLD whois |
2 | daniel-mar | 7 | # |
5 | daniel-mar | 8 | # (c) 2014 by Daniel Marschall, ViaThinkSoft <info@daniel-marschall.de> |
2 | daniel-mar | 9 | # |
5 | daniel-mar | 10 | # License: https://www.gnu.org/licenses/gpl-2.0.html (GPL version 2) |
2 | daniel-mar | 11 | # |
12 | |||
13 | /* |
||
14 | |||
15 | Official whois server is: vunic.vu |
||
16 | |||
17 | But the page http://www.vunic.vu/whoiss/whois.php |
||
18 | contains following additional information: |
||
19 | |||
20 | - Date modified |
||
21 | - Registrar |
||
22 | |||
23 | */ |
||
24 | |||
25 | require_once __DIR__ . '/../../shared/php_includes/common_functions.inc.php'; |
||
26 | |||
27 | $domain = isset($argv[1]) ? $argv[1] : ''; |
||
28 | |||
29 | if (preg_match('@(.*)((|\.com|\.edu|\.net|\.org)(\.vu))@isU', $domain, $m)) { |
||
30 | $domain_wotld = $m[1]; |
||
31 | $tld = $m[2]; |
||
32 | } else { |
||
33 | echo "'$domain' is not a valid .vu domain.\n"; |
||
34 | exit(2); |
||
35 | } |
||
36 | |||
37 | $url = 'http://www.vunic.vu/whoiss/process_whois.php'; |
||
38 | |||
39 | $post = 'domain='.rawurlencode($domain_wotld).'&ext='.rawurlencode($tld); |
||
40 | |||
41 | $cont = file_get_contents2($url, $post); |
||
42 | |||
43 | $cont = str_replace('</tr>', "\n", $cont); |
||
44 | |||
45 | $cont = html_entity_decode(strip_tags($cont)); |
||
46 | |||
47 | // Remove whitespaces at the beginning of each line |
||
48 | $cont = preg_replace('@([\r\n])[ \t]+(\S)@isU', '\\1\\2', $cont); |
||
49 | $cont = trim($cont); |
||
50 | |||
51 | $cont = str_replace("\r", '', $cont); |
||
52 | |||
53 | $ary = explode("\n", $cont); |
||
54 | $cont = ''; |
||
55 | foreach ($ary as $a) { |
||
56 | $a = trim($a); |
||
57 | if ($a == '') continue; |
||
58 | $cont .= "$a\n"; |
||
59 | } |
||
60 | |||
61 | $cont = preg_replace('@^(Domain|Registrar|Date Created|Date Modified|Expiry Date)\n@ismU', '$1: ', $cont); |
||
62 | |||
63 | $cont = str_replace('DNS Server', |
||
64 | "\nDNS Server\n", $cont); |
||
65 | |||
66 | $cont = str_replace('Registrant', |
||
67 | "\nRegistrant\n", $cont); |
||
68 | |||
69 | $cont = str_replace('Other results you may like', |
||
70 | "\nOther results you may like\n\n", $cont); |
||
71 | |||
72 | $cont = preg_replace("@ {0,1}:\n@ismU", ": ", $cont); |
||
73 | $cont = str_replace(' : ', ': ', $cont); |
||
74 | |||
75 | # --- |
||
76 | |||
77 | $puburl = 'http://www.vunic.vu/whoiss/whois.php'; |
||
78 | |||
79 | echo "Information about $domain extracted from $puburl:\n\n"; |
||
80 | echo $cont."\n"; |