Recommend this page to a friend! |
Download |
Info | Documentation | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not enough user ratings | Total: 51 | All time: 10,675 This week: 146 |
Version | License | PHP version | Categories | |||
top-domain 1.0 | Custom (specified... | 5 | Networking, PHP 5, Web services |
Description | Author | |
This class can retrieve domains from Alexa top 1 million domains. |
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
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";
}
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 (5) |
File | Role | Description | ||
---|---|---|---|---|
src (1 file) | ||||
composer.json | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
README.md | Doc. | Documentation | ||
top-domain-fetch-file.sh | Data | Auxiliary data |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.