Last active
April 19, 2019 18:17
-
-
Save tutweb/4cb38af381c1d479c8db56ed4666550a to your computer and use it in GitHub Desktop.
PHP Alexa Rank Checker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Ranking Alexa dengan PHP | |
* | |
* @param string $domain (www.jurnalweb.com) | |
* @return int || void | |
*/ | |
function AlexaRank($domain){ | |
$uri = 'http://data.alexa.com/data?cli=10&dat=snbamz&url='; | |
$uri .= $domain; | |
$xml = simplexml_load_file($uri); | |
// Data apa saja yang didapat bisa Anda lihat dengan fungsi print_r($xml) | |
//print_r($xml); die; | |
if (isset($xml->SD[1]->POPULARITY)) | |
return (int) $xml->SD[1]->POPULARITY->attributes()->TEXT; | |
} | |
echo "Ranking Alexa Jurnalweb.com adalah: ".AlexaRank('jurnalweb.com'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
no longer available