如何获得交通数据,子域数据,国家排名百分比,如http://www.websiteoutlook.com/www.google.com?
注意:这种方法不再适用。端点只返回“Ok”,即使对于未分配的URL也是如此。
有一个免费的API(虽然我无法在任何地方找到任何文档)。
http://data.alexa.com/data?cli=10&url=%YOUR_URL%
您还可以通过以下方式查询更多数据:
http://data.alexa.com/data?cli=10&dat=snbamz&url=%YOUR_URL%
dat中的所有字母都是决定您获得哪些信息的字母。这个数据字符串是我能够找到的,似乎有更多选项。此外,cli完全改变了输出,这个选项使它返回一个包含大量信息的XML。
编辑:此API是Alexa工具栏使用的API。
获得alexa排名的简单功能
function alexa_rank($url){
$xml = simplexml_load_file("http://data.alexa.com/data?cli=10&url=".$url);
if(isset($xml->SD)):
return $xml->SD->REACH->attributes();
endif;
}
工作得很好,免费;)
你也可以用它
<?php
$url="http://stackoverflow.com/";
$xml = simplexml_load_file('http://data.alexa.com/data?cli=10&dat=snbamz&url='.$url);
$rank=isset($xml->SD[1]->POPULARITY)?$xml->SD[1]->POPULARITY->attributes()->TEXT:0;
$web=(string)$xml->SD[0]->attributes()->HOST;
echo $web." has Alexa Rank ".$rank;
?>
这将输出它
stackoverflow.com has Alexa Rank 55
Alexa有一个API here。但这不是免费的。
SimilarWeb有一个公开其流量和排名数据的API。他们还提供参与度指标,推荐和域名分类API等,所以它可能对您有好处。
API - developer.similarweb.com
通过使用http://data.alexa.com/data?cli=10&url=%YOUR_URL% API,您可以获得所有数据。
function api_traffic (URL, KEY) {
var apiurl = "http://api.similarweb.com/Site/"
+ URL
+ "/v2/EstimatedTraffic?Format=JSON&UserKey=";
+ "KEY";
var fetch_visitors = UrlFetchApp.fetch(apiurl);
Utilities.sleep(2000);
var data = JSON.parse( fetch_visitors);
return data.EstimatedVisitors;
}
http://www.siteprice.org/api/是我认为最便宜的,也很容易使用。
$worthofwebsite= file_get_contents('http://www.siteprice.org/WorthApi.aspx?type=1&key=testkey&url=google.com');
echo "Website Worth: ".$worthofwebsite;
还有一个Web服务,它汇总了alexa排名+真实数据并进行了流量估算:http://www.rank2traffic.com/