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: gu TLD whois |
2 | daniel-mar | 7 | # |
5 | daniel-mar | 8 | # (c) 2013 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 | # TODO: check if all preg_match() did succeed |
||
14 | # TODO: check if the query did output exactly 1 record. |
||
15 | # TODO: Is there any better way to retrieve the information of a domain without full text search engine? |
||
16 | |||
17 | require_once __DIR__ . '/../../shared/php_includes/common_functions.inc.php'; |
||
18 | |||
19 | $domain = isset($argv[1]) ? $argv[1] : ''; |
||
20 | |||
21 | $url = 'http://gadao.gov.gu/Scripts/dtSearch/dtisapi.dll'; |
||
22 | |||
23 | $post = 'cmd=search&SearchForm=C:\Inetpub\wwwroot\domainsearch_form.htm&request=Domain%20name:%20'.rawurlencode($domain).'&index=C:\dtSearch\BIN\domain&maxFiles=25&stemming=Yes'; |
||
24 | |||
25 | $cont = file_get_contents2($url, $post); |
||
26 | |||
27 | if (!preg_match('@target="doc">(.*)\\.htm</A>@ismU', $cont, $m)) { |
||
28 | echo "Domain $domain not found or the parsing script is outdated.\n"; |
||
29 | exit(1); |
||
30 | } |
||
31 | $a = $m[1]; |
||
32 | $url2 = "http://gadao.gov.gu/domain/$a.htm"; |
||
33 | |||
34 | preg_match('@<TD align=right>((\\d+)/(\\d+)/(\\d+))</TD>@ismU', $cont, $m); |
||
35 | //$moddate = $m[1]; |
||
36 | $month = $m[2]; |
||
37 | $day = $m[3]; |
||
38 | $year = $m[4]; |
||
39 | $moddate = date('Y-m-d', mktime(0, 0, 0, $month, $day, $year)); |
||
40 | |||
41 | $cont2 = file_get_contents2($url2); |
||
42 | preg_match('@<pre>(.+)</pre>@ismU', $cont2, $m); |
||
43 | |||
44 | echo "Content of $url2 (Last modified: $moddate)\n\n"; |
||
45 | echo trim(html_entity_decode($m[1]))."\n"; |