Technorati Grabber: Get Your Technorati Rank and Authority
Written by David Walsh on Wednesday, November 5, 2008
Technorati is one of those sites that’s like Alexa in that you get an assigned rank. You also get what is called “authority,” which represents:
Technorati Authority is the number of blogs linking to a website in the last six months. The higher the number, the more Technorati Authority the blog has.
…
Technorati Rank is calculated based on how far you are from the top. The blog with the hightest Technorati Authority is the #1 ranked blog. The smaller your Technorati Rank, the closer you are to the top.
If you’re looking to find the your technorati rank and authority in an automated matter, look no further than this snippet of PHP.
The PHP
//url
$url = 'http://technorati.com/blogs/davidwalsh.name';
//get the page content
$site = get_data($url);
//parse for product name
$authority = get_match('/Authority: (.*)<\/a>/isU',$site);
$rank = get_match('/Rank: (.*) /isU',$site);
//build content
$content.= 'Authority: '.$authority.'
';
$content.= 'Rank: '.$rank.'
';
//gets the match content
function get_match($regex,$content)
{
preg_match($regex,$content,$matches);
return $matches[1];
}
//gets the data from a URL
function get_data($url)
{
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
This grabber was too easy, as Technorati’s source code doesn’t put up much of a fight. Happy grabbing!
Epic Discussion
Be Heard!
I want to hear what you have to say! Share your comments and questions below.
how to asp version ?
@sinan: Yeah…you probably wont find that on this blog…
Why scrape when they’ve got a perfectly good API?
@Joost: This is meant for non-critical, quick and dirty information grabbing. For something important, one should use the API.