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