PHP Classes
elePHPant
Icontem

PHP Alexa Rank Top Domain: Retrieve domains from Alexa top 1 million domains

Recommend this page to a friend!
  Info   View files Documentation   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2017-07-06 (3 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 36 All time: 9,026 This week: 548Up
Version License PHP version Categories
top-domain 1.0Custom (specified...5Networking, PHP 5, Web services
Description Author

This class can retrieve domains from Alexa top 1 million domains.

It can access the list of top 1 million domains in Alexa Rank from a previously retrieved list in the CSV file and retrieves domains by certain criterion.

Currently it can pick a random domain, find a domain by name, and get a limited range of domains by rank position.

  Performance   Level  
Name: Peter Kahl <contact>
Classes: 32 packages by
Country: Hong Kong Hong Kong
Age: ???
All time rank: 6734 in Hong Kong Hong Kong
Week rank: 14 Up1 in Hong Kong Hong Kong Up
Innovation award
Innovation award
Nominee: 19x

Details

Top Domain

Top 1 million domains list. Random domain. Check if your domain is in the top 1 million. Get a list of X domains.

This library utilizes Alexa's Top 1 Million Domains data file:

http://s3.amazonaws.com/alexa-static/top-1m.csv.zip

Usage

use peterkahl\TopDomain\TopDomain;

$tdomObj = new TopDomain;
$tdomObj->CacheDir = '/srv/cache';

#-----------------------------------------
# Get random domain
$temp = $tdomObj->RandomDomain();
echo $temp['domain'] .' ............. '. $temp['rank'] ."\n";

#-----------------------------------------
# Check if given domain is in the top 1 million.
$temp = $tdomObj->FindDomain('alipay.com');

echo $temp['domain'];
if (empty($temp)) {
  echo ' is not in the top 1 million.' ."\n";
}
else {
  echo ' is in the top 1 million with rank '. $temp['rank'] .'.' ."\n";
}

#-----------------------------------------
# Get a list of domains 1 through 100.
$temp = $tdomObj->GetDomains(1, 100);

foreach ($temp as $val) {
  echo $val['rank'] .' ............. '. $val['domain']  ."\n";
}

Important

You probably want to set up a crontab job to periodically update the Alexa data file, perhaps by using the shell script top-domain-fetch-file.sh. Don't forget to edit this file with the correct location of your cache directory!

  Files folder image Files  
File Role Description
Files folder imagesrc (1 file)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file top-domain-fetch-file.sh Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
  Plain text file TopDomain.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:36
This week:0
All time:9,026
This week:548Up