php 获取 Alexa 数据

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3676376/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 10:40:05  来源:igfitidea点击:

Fetching Alexa data

phpapialexa

提问by Prakash

How is it possible to get traffic data, sub domains data, country rank in percentage like in http://www.websiteoutlook.com/www.google.com?

如何像http://www.websiteoutlook.com/www.google.com那样获取流量数据、子域数据、国家/地区排名百分比?

回答by Lumbendil

NB: This approach doesn't work anymore. The endpoint simply returns "Ok", even for URLs which aren't assigned.

注意这种方法不再适用。即使对于未分配的 URL,端点也会简单地返回“Ok”。

There is a free API (though I haven't been able to find any documentation for it anywhere).

有一个免费的 API(尽管我无法在任何地方找到任何文档)。

http://data.alexa.com/data?cli=10&url=%YOUR_URL%

You can also query for more data the following way:

您还可以通过以下方式查询更多数据:

http://data.alexa.com/data?cli=10&dat=snbamz&url=%YOUR_URL%

All the letters in datare the ones that determine which info you get. This dat string is the one I've been able to find which seems to have more options. Also, cli changes the output completely, this option makes it return an XML with quite a lot of information.

dat中的所有字母决定了您获得哪些信息。这个 dat 字符串是我能够找到的似乎有更多选项的字符串。此外,cli 完全改变了输出,这个选项使它返回一个包含相当多信息的 XML。

EDIT: This API is the one used by the Alexa toolbar.

编辑:此 API 是 Alexa 工具栏使用的 API。

回答by Warface

A simple function to get the alexa rank

一个简单的函数来获得 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;
}

Works pretty well and free ;)

效果很好,而且免费 ;)

回答by Abdalla Mohamed Aly Ibrahim

you can use this too

你也可以用这个

<?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;
?>

this will output it like

这将输出它像

stackoverflow.com has Alexa Rank 55

回答by Pekka

Alexa have an API here. It's not free, though.

Alexa在这里有一个 API 。不过,它不是免费的。

回答by vsync

SimilarWebhas an API that exposes its traffic and ranking data. They also provide engagement metrics, referrals and domain categorization APIs, among others, so maybe it'll be good for you.

SimilarWeb有一个 API 可以公开其流量和排名数据。他们还提供参与度指标、推荐和域分类 API 等,因此可能对您有好处。

API- developer.similarweb.com

API- developer.similarweb.com

回答by Aneek Mukhopadhyay

By using http://data.alexa.com/data?cli=10&url=%YOUR_URL%API you can have all data.

通过使用 http://data.alexa.com/data?cli=10&url=%YOUR_URL%API,您可以获得所有数据。

回答by Noam Schwartz

Usage for SimilarWebTraffic API:

SimilarWeb流量 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;
    }

回答by Salim

http://www.siteprice.org/api/is the cheapest I think and easy to use.

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;

回答by Andrew Rukin

There is also a web service which aggregated alexa ranks + real data and made traffic estimations: http://www.rank2traffic.com/

还有一个聚合alexa排名+真实数据并进行流量估算的网络服务:http: //www.rank2traffic.com/