Skip to content

Instantly share code, notes, and snippets.

@tayfunerbilen
Last active March 16, 2019 23:43
Show Gist options
  • Save tayfunerbilen/7679514 to your computer and use it in GitHub Desktop.
Save tayfunerbilen/7679514 to your computer and use it in GitHub Desktop.
php alexa bilgileri
<?php
// site url
$url = 'http://www.erbilen.net';
// get data
$alexa = simplexml_load_file('http://data.alexa.com/data?cli=10&url='.$url);
// global rank
$globalRank = number_format( (int) $alexa->SD->POPULARITY['TEXT'] );
// country rank
$countryCode = $alexa->SD->COUNTRY['CODE'];
$countryName = $alexa->SD->COUNTRY['NAME'];
$countryRank = number_format( (int) $alexa->SD->COUNTRY['RANK'] );
// global rank print
print $globalRank;
print '<hr />';
// country rank print
print $countryName.' '.$countryRank;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment