2012-01-05 53 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