2012-01-05 50 views

回答

0

Netcraft的格式良好的數據很可能來自DNS記錄。不幸的是,DNS記錄本身並不經常(或者不需要Netcraft)。

你在做什麼聽起來有點邪惡,但也許嘗試使用像whois這樣的系統命令然後搜索電子郵件地址。

<?php 
$domain = 'cnn.com'; 
$results = shell_exec("whois {$domain}"); 
//parse results here 
?> 
0

dWhenever you want to scrape content with php,cURL is your friend。下面使用的

簡單的例子:

<?php 

$curl_handle=curl_init(); 
curl_setopt($curl_handle,CURLOPT_URL,'http://example.com'); 
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2); 
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1); 
$buffer = curl_exec($curl_handle); 
curl_close($curl_handle); 

if (empty($buffer)) 
{ 
    print "Unable to fetch data."; 
} 
else 
{ 
    print $buffer; 
} 
?> 

當然,你需要解析的獲取和提取任何你需要的結果。

希望有所幫助,祝你好運!

UPDATE:不知道運想獲取從網頁結果,或直接從一個DNS查詢工具(挖,域名註冊等。)。如果我理解錯誤,這篇文章將被刪除。

1

最好的選擇很可能是直接得到的DNS記錄:

<?php 
$result = dns_get_record("example.com", DNS_SOA); 
$admin = preg_replace('/\./', '@', $result[0]['rname'], 1); //need to replace the first dot with "@" because the rname is passed with dots and doesn't include "@" 
echo $admin; //will output [email protected] 
?> 

閱讀關於PHP的dns_get_record功能。

+0

FWIW這是比我更好的答案。不知道有'dns_get_record'方法! – buley 2012-01-05 20:15:29

+0

我目前正在使用像這樣的解決方案,但我擔心我可以提取一個像some.email.company.com這樣的電子郵件,並將它翻譯爲[email protected]:/ – budidino 2013-05-08 09:51:22

+0

不知道如何這個解決方案是可行的,但你可以試着ping子域名變體並檢查狀態代碼如果email.company.com返回404,則嘗試ping ping company.com,如果返回200,則company.com是域,some.email是電子郵件帳戶。只是一個想法。 – Ignas 2013-05-09 12:51:19