Rev 21 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
21 | daniel-mar | 1 | #!/usr/bin/php |
2 | <?php |
||
3 | |||
4 | # |
||
5 | # VGWhoIs (ViaThinkSoft Global WhoIs, a fork of generic Whois / gwhois) |
||
6 | # Subprogram: bd TLD whois |
||
7 | # |
||
8 | # (c) 2019 by Daniel Marschall, ViaThinkSoft <info@daniel-marschall.de> |
||
9 | # |
||
10 | # License: https://www.gnu.org/licenses/gpl-2.0.html (GPL version 2) |
||
11 | # |
||
12 | |||
13 | require_once __DIR__ . '/../../shared/php_includes/common_functions.inc.php'; |
||
14 | |||
15 | $domain = isset($argv[1]) ? $argv[1] : ''; |
||
16 | |||
17 | if (preg_match('@(.*)(\.bd)@isU', $domain, $m)) { |
||
18 | $domain_without_tld = $m[1]; |
||
19 | } else { |
||
20 | echo "'$domain' is not a valid .bd domain.\n"; |
||
21 | exit(2); |
||
22 | } |
||
23 | |||
24 | $url = 'https://www.registry.com.bd/whois.php?dName='.urlencode($domain_without_tld).'&Submit=Lookup+'; |
||
25 | |||
26 | $cont = file_get_contents($url); |
||
27 | |||
28 | if (preg_match('@<h3 class="block-head">Result</h3>(.+)</div>@ismU', $cont, $m)) { |
||
29 | $cont = $m[1]; |
||
30 | } |
||
31 | |||
32 | $cont = strip_tags($cont); |
||
33 | $cont = preg_replace("@\n\n+@", "\n", $cont); |
||
34 | $cont = trim($cont); |
||
35 | |||
36 | echo "Information about $domain extracted from $url:\n\n"; |
||
37 | echo $cont."\n"; |