|
@ -225,6 +225,9 @@ function splitHtml($htmlFile) { |
|
|
} |
|
|
} |
|
|
foreach ($result as &$row) { |
|
|
foreach ($result as &$row) { |
|
|
$row = trim($row); |
|
|
$row = trim($row); |
|
|
|
|
|
$row = str_replace(''', '\'', $row); |
|
|
|
|
|
$row = str_replace('&', '&', $row); |
|
|
|
|
|
$row = str_replace('"', '"', $row); |
|
|
} |
|
|
} |
|
|
return $result; |
|
|
return $result; |
|
|
} |
|
|
} |
|
@ -260,7 +263,7 @@ function getHtmlType($str) { // 提取TLD类型 |
|
|
case '(Restricted generic top-level domain)': |
|
|
case '(Restricted generic top-level domain)': |
|
|
return 'Restricted TLD'; |
|
|
return 'Restricted TLD'; |
|
|
case '(Test top-level domain)': |
|
|
case '(Test top-level domain)': |
|
|
return 'TLD for test'; |
|
|
return 'Test TLD'; |
|
|
default: |
|
|
default: |
|
|
die('error analyse -> type'); |
|
|
die('error analyse -> type'); |
|
|
} |
|
|
} |
|
@ -269,8 +272,8 @@ function getHtmlType($str) { // 提取TLD类型 |
|
|
function getHtmlManager($str) { // 提取TLD所有者信息 |
|
|
function getHtmlManager($str) { // 提取TLD所有者信息 |
|
|
if ($str == '') { |
|
|
if ($str == '') { |
|
|
return array( |
|
|
return array( |
|
|
'manager' => '', |
|
|
'name' => array(), |
|
|
'manager_info' => '' |
|
|
'addr' => array() |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
$temp = explode('</b><br/>', $str); |
|
|
$temp = explode('</b><br/>', $str); |
|
@ -278,17 +281,19 @@ function getHtmlManager($str) { // 提取TLD所有者信息 |
|
|
die('error analyse -> manager'); |
|
|
die('error analyse -> manager'); |
|
|
} |
|
|
} |
|
|
$manager = trim($temp[0]); |
|
|
$manager = trim($temp[0]); |
|
|
|
|
|
preg_match('/\\\u[0-9a-f]{4}/', $manager, $match); |
|
|
$manager = substr($manager, 3 - strlen($manager)); |
|
|
$manager = substr($manager, 3 - strlen($manager)); |
|
|
if ($manager === 'Not assigned') { |
|
|
if ($manager === 'Not assigned') { |
|
|
return array( |
|
|
return array( |
|
|
'manager' => '', |
|
|
'name' => array(), |
|
|
'manager_info' => '' |
|
|
'addr' => array() |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
$manager = explode('<br>', $manager); |
|
|
if ($temp[1] == '') { |
|
|
if ($temp[1] == '') { |
|
|
return array( |
|
|
return array( |
|
|
'manager' => $manager, |
|
|
'name' => $manager, |
|
|
'manager_info' => '' |
|
|
'addr' => array() |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
$temp = str_replace('<br>', '<br/>', trim($temp[1])); |
|
|
$temp = str_replace('<br>', '<br/>', trim($temp[1])); |
|
@ -303,8 +308,8 @@ function getHtmlManager($str) { // 提取TLD所有者信息 |
|
|
die('error analyse -> manager'); |
|
|
die('error analyse -> manager'); |
|
|
} |
|
|
} |
|
|
return array( |
|
|
return array( |
|
|
'manager' => $manager, |
|
|
'name' => $manager, |
|
|
'manager_addr' => $manager_addr |
|
|
'addr' => $manager_addr |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -370,7 +375,7 @@ function getHtmlContact($str) { // 提取联系人信息 |
|
|
$flag = false; |
|
|
$flag = false; |
|
|
foreach ($temp as $line) { |
|
|
foreach ($temp as $line) { |
|
|
if (!$flag) { |
|
|
if (!$flag) { |
|
|
$result['org'] = $line; |
|
|
$result['org'] = preg_replace('/[\s]+/', ' ', $line); |
|
|
$flag = true; |
|
|
$flag = true; |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
@ -398,15 +403,21 @@ function getHtmlContact($str) { // 提取联系人信息 |
|
|
if ($result['email'] != '' && substr($result['email'], -5) !== '<br/>') { |
|
|
if ($result['email'] != '' && substr($result['email'], -5) !== '<br/>') { |
|
|
die('error analyse -> contact'); |
|
|
die('error analyse -> contact'); |
|
|
} |
|
|
} |
|
|
|
|
|
if ($result['email'] !== '') { |
|
|
$result['email'] = substr($result['email'], 0, strlen($result['email']) - 5); |
|
|
$result['email'] = substr($result['email'], 0, strlen($result['email']) - 5); |
|
|
|
|
|
} |
|
|
if ($result['voice'] != '' && substr($result['voice'], -5) !== '<br/>') { |
|
|
if ($result['voice'] != '' && substr($result['voice'], -5) !== '<br/>') { |
|
|
die('error analyse -> contact'); |
|
|
die('error analyse -> contact'); |
|
|
} |
|
|
} |
|
|
|
|
|
if ($result['voice'] !== '') { |
|
|
$result['voice'] = substr($result['voice'], 0, strlen($result['voice']) - 5); |
|
|
$result['voice'] = substr($result['voice'], 0, strlen($result['voice']) - 5); |
|
|
|
|
|
} |
|
|
if ($result['fax'] != '' && substr($result['fax'], -5) !== '<br/>') { |
|
|
if ($result['fax'] != '' && substr($result['fax'], -5) !== '<br/>') { |
|
|
die('error analyse -> contact'); |
|
|
die('error analyse -> contact'); |
|
|
} |
|
|
} |
|
|
|
|
|
if ($result['fax'] !== '') { |
|
|
$result['fax'] = substr($result['fax'], 0, strlen($result['fax']) - 5); |
|
|
$result['fax'] = substr($result['fax'], 0, strlen($result['fax']) - 5); |
|
|
|
|
|
} |
|
|
if ($result['fax'] === 'n/a' || $result['fax'] === 'NA' || $result['fax'] === 'N/A' || $result['fax'] === '-') { |
|
|
if ($result['fax'] === 'n/a' || $result['fax'] === 'NA' || $result['fax'] === 'N/A' || $result['fax'] === '-') { |
|
|
$result['fax'] = ''; |
|
|
$result['fax'] = ''; |
|
|
} |
|
|
} |
|
@ -476,12 +487,6 @@ function getHtmlNS($str) { // 提取TLD名称服务器 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function getHtmlInfo($str) { // 获取官网/Whois服务器信息 |
|
|
function getHtmlInfo($str) { // 获取官网/Whois服务器信息 |
|
|
// if ($str == '') { |
|
|
|
|
|
// return array( |
|
|
|
|
|
// 'website' => '', |
|
|
|
|
|
// 'whois' => '' |
|
|
|
|
|
// ); |
|
|
|
|
|
// } |
|
|
|
|
|
preg_match_all('/<p>[\s\S]+?<\/p>/', $str, $match); |
|
|
preg_match_all('/<p>[\s\S]+?<\/p>/', $str, $match); |
|
|
if (count($match) !== 1) { |
|
|
if (count($match) !== 1) { |
|
|
die('error analyse -> info'); |
|
|
die('error analyse -> info'); |
|
|