|
How to check Alexa rank in PHP
Hi, Here is a small script that will let you check the Alexa rank for any website from your server (PHP needed), google.com is only an example, you can change it as you wish of course. $url = 'google.com';
Quite easy, isn't it? ![]() I hope it will help. bradleyscott (2010-09-24 09:26:26) How to check Alexa rank in PHP Alexa provides this information in many useful formats, including XML. Using the XML provided by Alexa, we can gain access to Alexa information within our pages. I've created a PHP class to make fetching Alexa data free, quick, and easy. The class comes in a PHP4 version and a PHP5 version. The Code - PHP4 Version /* the alexa rank class */ class alexa { /* initial vars */ var $xml; var $values; var $alexa_address; /* the constructor */ function alexa($alexa_address,$domain) { $this->alexa_address = $alexa_address; $this->xml = $this->get_data($domain); $this->set(); } /* gets the xml data from Alexa */ function get_data($domain) { $url = $this->alexa_address.'http://'.$domain; $xml = file_get_contents($url); return $xml; } /* set values in the XML that we want */ function set() { $this->values['rank'] = (preg_match('/POPULARITY URL="[a-z0-9\\-\\.\\/]{1,}" TEXT="([0-9]{1,12})"/',$this->xml,$regs) ? number_format($regs[1]) : 0); $this->values['reach'] = (preg_match('/REACH RANK="([0-9]{1,12})"/',$this->xml,$regs) ? number_format($regs[1]) : 0); $this->values['linksin'] = (preg_match('/LINKSIN NUM="([0-9]{1,12})"/',$this->xml,$regs) ? number_format($regs[1]) : 0); } /* returns the requested value */ function get($value) { return (isset($this->values[$value]) ? $this->values[$value] : '"'.$value.'" does not exist.'); } } Copy this code to the clipboard 1/* the alexa rank class */ 2class alexa 3{ 4 /* initial vars */ 5 var $xml; 6 var $values; 7 var $alexa_address; 8 9 /* the constructor */ 10 function alexa($alexa_address,$domain) 11 { 12 $this->alexa_address = $alexa_address; 13 $this->xml = $this->get_data($domain); 14 $this->set(); 15 } 16 17 /* gets the xml data from Alexa */ 18 function get_data($domain) 19 { 20 $url = $this->alexa_address.'http://'.$domain; 21 $xml = file_get_contents($url); 22 return $xml; 23 } 24 25 /* set values in the XML that we want */ 26 function set() 27 { 28 $this->values['rank'] = (preg_match('/POPULARITY URL="[a-z0-9\\-\\.\\/]{1,}" TEXT="([0-9]{1,12})"/',$this->xml,$regs) ? number_format($regs[1]) : 0); 29 $this->values['reach'] = (preg_match('/REACH RANK="([0-9]{1,12})"/',$this->xml,$regs) ? number_format($regs[1]) : 0); 30 $this->values['linksin'] = (preg_match('/LINKSIN NUM="([0-9]{1,12})"/',$this->xml,$regs) ? number_format($regs[1]) : 0); 31 } 32 33 /* returns the requested value */ 34 function get($value) 35 { 36 return (isset($this->values[$value]) ? $this->values[$value] : '"'.$value.'" does not exist.'); 37 } 38} __________ Buy Research papers Purchase Term papers Custom Written essays healthtourism (2011-06-25 12:17:55) 13 years ago You can install the widget on your website. Prostate Cancer Treatment Mexico *dimugi (2019-08-01 10:54:52) 5 years ago How do you think the schism in the rec center would most likely have an effect on politics relationships from the Byzantine empire but also north western the uk later on yet, near gulf politics approach, while there is seculrization about religion in addition country, Secularism develops the muse as for russian women dating of these concepts, at the same time not they all, But many of them, Presupposing such motif in rustic outdoor. present in far terms, The distinction between them stems from the disturbance involving religious beliefs in worldy affairs read more political research is far more focused on the insides of hawaii as well as, while items. at all times, how they really fixate the study of a person russian babes office of the state, similar to the obama administration, Legislature, actually judiciary. alternate branches aim for voting routines, politics individuals or groups, associations involving states in the usa (world Relations/Foreign insurance), or variation involving political communities (relative the government). Sociology but is more focused on the health and wellbeing having to do with organizations. assuming they do add the state read more. See also ficgs More websites You must register to see these links, as this is a collaborative page, then you may change the order of the links by clicking the icons before the titles. admin Other websites The following links might be less relevant, please change their ranks if you find them useful. ![]() ![]() selfseo > alexa rank checker.php ![]() ![]() weberdev > get example 4850 How to build a search query for any N number of words in a search... Query2Report : Generating Html, Pdf and Csv Reports from SQL... ![]() ![]() davidwalsh > php alexa rank fetcher xml /* the alexa rank class */ class alexa { /* initial vars */ var... but i get error on this simplexml_load_file function, saying... ![]() ![]() forums.digitalpoint > s Weight 177 - 150,000+ pages indexed 15400 backlinks... Script to check alexa rank, backlinks and indexed... ![]() ![]() bytechip > 2010/04/get alexa rank using php page, but since the rank keeps changing they got to update it often,... div', activeClass: 'active', linksNav: '',... ![]() ![]() alexpolski > 2008/04/23 ![]() ![]() webdigity.wordpress > 2007/04/17/php code to retrieve your alexa rank Crazy Fast cPanel Shared Hosting and FFmpeg Hosting with LiteSpeed... How to Create Interactive Multiple-choice Quiz in Adobe Flash... ![]() ![]() alexa > help/viewtopic.php?f=5&t=13501 ![]() ![]() smartpagerank > extension.php ![]() ![]() justin cook > wp/2006/12/28/check alexa pagerank googlemsnyahoo backlinks de script dont work, de error curl lib not, found, so who to added... How to add a calendar (date picker) to your web... ![]() ![]() wordpressapi > alexa ranking php code ![]() ![]() cn.alexa > help/viewtopic.php?f=5&t=14701 ![]() ![]() webquirk > tutorials/PHP/build an alexa rank checker ![]() ![]() techmynd > alexa traffic rank charts graphs statistics Monitor Website Weight, Load Time at Different Internet Connections... How to Display Alexa Traffic Rank Statistics at Your... Download Free AVG Antivirus Complete Security for Android... ![]() ![]() top25web > bbs/viewtopic.php?f=28&t=6645&start=0 ![]() ![]() phpform > board/index.php?topic=3.0 What does:Parse error: syntax error, unexpected '*' in... ![]() ![]() power links > sub alexa rank check allowing them to provide statistics on web site traffic, as well as... ![]() ![]() metatitan > php/13 ![]() ![]() globalguideline > articles/analysis.php?k=PHP script to check Google pagerank //set this variable to 1 if you wish the URLs of the highlighted... So this is the end of the second file that is using the first... Click here to learn about SQL basics and developed... ![]() ![]() script.wareseeker > PHP/php google page rank alexa rank dmoz listing search engi PHP Google Page Rank,Alexa Rank,DMOZ Listing,Search Engine Backlink... Google Page Rank,Alexa Rank,DMOZ Listing,Google,Yahoo,MSN,... ![]() ![]() mediawiki > wiki/Extension:AlexaRank This page was last modified on 21 February 2008, at... There's no trackback at the moment.
[Games online]
[Last topics]
[Glossary]
[Help]
[Membership]
[About]
[Social network] [Hot news] [Discussions] [Seo forums] [Meet people] [Directory] |