Rev 5 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5 | Rev 11 | ||
---|---|---|---|
1 | #!/usr/bin/php |
1 | #!/usr/bin/php |
2 | <?php |
2 | <?php |
3 | 3 | ||
4 | # |
4 | # |
5 | # VWhois (ViaThinkSoft WHOIS, a fork of generic Whois / gwhois) |
5 | # VGWhoIs (ViaThinkSoft Global WhoIs, a fork of generic Whois / gwhois) |
6 | # Subprogram: vi TLD whois |
6 | # Subprogram: vi TLD whois |
7 | # |
7 | # |
8 | # (c) 2013 by Daniel Marschall, ViaThinkSoft <info@daniel-marschall.de> |
8 | # (c) 2013 by Daniel Marschall, ViaThinkSoft <info@daniel-marschall.de> |
9 | # |
9 | # |
10 | # License: https://www.gnu.org/licenses/gpl-2.0.html (GPL version 2) |
10 | # License: https://www.gnu.org/licenses/gpl-2.0.html (GPL version 2) |
11 | # |
11 | # |
12 | 12 | ||
13 | require_once __DIR__ . '/../../shared/php_includes/common_functions.inc.php'; |
13 | require_once __DIR__ . '/../../shared/php_includes/common_functions.inc.php'; |
14 | 14 | ||
15 | $domain = isset($argv[1]) ? $argv[1] : ''; |
15 | $domain = isset($argv[1]) ? $argv[1] : ''; |
16 | 16 | ||
17 | $url = 'https://secure.nic.vi/whois-lookup/'; |
17 | $url = 'https://secure.nic.vi/whois-lookup/'; |
18 | 18 | ||
19 | $post = 'submitted=true&domainName='.rawurlencode($domain); |
19 | $post = 'submitted=true&domainName='.rawurlencode($domain); |
20 | 20 | ||
21 | $cont = file_get_contents2($url, $post); |
21 | $cont = file_get_contents2($url, $post); |
22 | 22 | ||
23 | if (preg_match('@<div class="results">(.+)</div>@ismU', $cont, $m)) { |
23 | if (preg_match('@<div class="results">(.+)</div>@ismU', $cont, $m)) { |
24 | $cont = $m[1]; |
24 | $cont = $m[1]; |
25 | } |
25 | } |
26 | 26 | ||
27 | // There is a "secret" field named "Name". Why hide it? |
27 | // There is a "secret" field named "Name". Why hide it? |
28 | $cont = str_replace('<!--', '', $cont); |
28 | $cont = str_replace('<!--', '', $cont); |
29 | $cont = str_replace('-->', '', $cont); |
29 | $cont = str_replace('-->', '', $cont); |
30 | 30 | ||
31 | $cont = html_entity_decode(strip_tags($cont)); |
31 | $cont = html_entity_decode(strip_tags($cont)); |
32 | 32 | ||
33 | // Remove whitespaces at the beginning of each line |
33 | // Remove whitespaces at the beginning of each line |
34 | $cont = preg_replace('@([\r\n])[ \t]+(\S)@isU', '\\1\\2', $cont); |
34 | $cont = preg_replace('@([\r\n])[ \t]+(\S)@isU', '\\1\\2', $cont); |
35 | $cont = trim($cont); |
35 | $cont = trim($cont); |
36 | 36 | ||
37 | echo "Information about $domain extracted from $url:\n\n"; |
37 | echo "Information about $domain extracted from $url:\n\n"; |
38 | echo $cont."\n"; |
38 | echo $cont."\n"; |