Using the Technorati API on your blog

In my effort to remove all badges from my front page and decrease the load time, I have now moved to using the Technorati API to display Technorati info. It looks like this:

Technorati API

The code is almost as easy as the code to display your FeedBurner subscribers or your last tweet. You’ll need to create an account with Technorati and then get your API key. That page will also tell you how much queries you’ve made that day, and what your daily allowance is.

This is the code, including caching:

$technorati = get_option("technorati");
if ($technorati['lastcheck'] < ( mktime() - 600 ) ) {
	$apikey 	= "apikey";
	$endpoint 	= "".$apikey;
	$request 	= $endpoint."&";
	$snoopy 	= new Snoopy;
	$result 	= $snoopy->fetch($request);
	if ($result) {
		$pattern1 = '/<inboundblogs>([0-9]+)<\/inboundblogs>/';
		$pattern2 = '/<inboundlinks>([0-9]+)<\/inboundlinks>/';
		$pattern3 = '/<rank>([0-9]+)<\/rank>/';
		preg_match($pattern1, $snoopy->results, $matches);
		preg_match($pattern2, $snoopy->results, $matches2);
		preg_match($pattern3, $snoopy->results, $matches3);
		$technorati['inboundblogs'] = number_format($matches[1]);
		$technorati['inboundlinks'] = number_format($matches2[1]);
		$technorati['rank'] 	= number_format($matches3[1]);
		$technorati['lastcheck']= mktime();
echo "<h3>Technorati</h3>";
echo "<p>".$technorati['inboundblogs']." blogs linked
	".$technorati['inboundlinks']." times in the last 6 months,
	ranking it as ".$technorati['rank']." among all blogs.</p>";

That’s it! Let me know if you’ve got any questions!

Tags: runs on the Genesis Framework

Genesis theme frameworkThe Genesis Framework empowers you to quickly and easily build incredible websites with WordPress. Whether you're a novice or advanced developer, Genesis provides you with the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go.

Read our Genesis review or get Genesis now!

26 Responses

  1. DavidBy David on 28 October, 2008

    Very cool! Now, I don’t have the much special things going on on Technorati, But it is very cool to see this kind of coding! :D Keep it up I would say!

  2. smotttBy smottt on 28 October, 2008

    I think this could be more easily done with simplexml object? Correct me if I’m wrong :)

  3. Joost de ValkBy Joost de Valk on 28 October, 2008

    @smott: Why load an entire simplexml object for a couple of regexes? :) And on top of that, that’s not available everywhere, this is :)

  4. RajeshBy Rajesh on 29 October, 2008

    I would say that it always better to do all these with javascripts (feedburner feed count or technorati links)…why do you want to hit the wp database for every showoff?

    server sided scripting is not only costly for these showoffs…but they are also incompatible with caching plugins like super cache…

  5. CVOS manBy CVOS man on 29 October, 2008

    @rajesh using javascript would cause extra stress on the end user (mobile, overseas, library etc.) and also negate potential SEO benefits of additional dynamic text on your site.

  6. Joost de ValkBy Joost de Valk on 29 October, 2008

    while I’m not so worried about the SEO benefits, I do worry about the extra scripts. Before I added this, my homepage footer would sometimes take 5-6 seconds to load…

  7. smotttBy smottt on 29 October, 2008

    @joost, you have a point there. I didn’t think in the way of availability and performance but only in the matter of simplicity :)

    @rajesh, not everyone has javascript enabled.

  8. LyndiBy Lyndi on 29 October, 2008

    Cool. I do not have lots to brag about on Technorati at the moment but now I know how to show the stats when the situation changes. Thanks.

  9. TertiusBy Tertius on 29 October, 2008

    Again, good post this. I’ll have to gain some ground before I get this going.

  10. RajeshBy Rajesh on 30 October, 2008


    i am not even sure about what SEO benefits he (CVOS man) is talking about…but i do agree with you that you could make the footer load better with the php script than with the javascript under normal circumstances…(when there is no sudden traffic surge)…


    i know that….even google analytics is a javascript and many are living with it…i wouldn’t be too interested on the visits from people who do not enable javascript…as there are no conversions and i am not optimizing my site for them…it is not a big deal if they don’t see the feed count or no. of technorati links…

  11. Lars BachmannBy Lars Bachmann on 30 October, 2008

    Cool script. I am using it in my footer, and the loadtime hasn’t changed much.
    My Technorati rank is nothing to be proud of though, but now it’s easy for me to follow it :)

  12. Vps-webhostingBy Vps-webhosting on 31 October, 2008

    Tried to use it on my website but did not work. Where do i paste the code in my blog.

  13. IronBloggerBy IronBlogger on 1 November, 2008

    My technorati rank is slowly rising, I don’t have much to brag about now, but maybe in a few months I can. I’m almost at the 100,000 mark :) .

  14. Nomadic MattBy Nomadic Matt on 3 November, 2008

    Do you think there is a benefit to having the technorati badge there?

  15. IronBloggerBy IronBlogger on 3 November, 2008

    I personally think that it may make a good impression to others about your blog, but thats about it.

  16. RajuBy Raju on 6 November, 2008

    real nice tip… keep them coming

  17. KestrelBy Kestrel on 6 November, 2008

    I’ll echo VPS_WebHosting’s query. I’ve pasted the code to my footer, and my footer displays the code (including my API key). I’ve also included and excluded the “snoopy” line: The only difference that made was to display that line along with the rest of the code.

  18. Pieter de MareesBy Pieter de Marees on 10 November, 2008

    Nice Query, I’m going too see if this can be ingrated into my website design.

  19. Tom_LindstromBy Tom_Lindstrom on 13 November, 2008

    Good tips.Having a good Technorati rank seems to be important because it is so respected,Is it possible to increase your rank by putting technorati-tags directly in your blog posts?

  20. Twitter SearchBy Twitter Search on 27 May, 2009

    thats great that you are talking about the twitter api,a good example of searching with the twitter api is on because you can search on twitter and google at the same time.

  21. Hooshmand MoslemiBy Hooshmand Moslemi on 1 July, 2009


    This is amazing. Using the Technorati API on our blog would give a better picture of the website in the entire community. However, it’s more suitable to successful blogs, web pages with tons of traffic, a lot of readers and subscribers, a large number of backlinks and high rankings.

    For a new blog, showing such an API would not seem so exciting. I guess this would work well for intermediate bloggers who are in the right path of success!

    But again, thanks for providing the code about Technorati info.


    Hooshmand Moslemi

  22. Sci-Fi SiBy Sci-Fi Si on 7 July, 2009

    Hello Yoast,

    There are a lot of comments of your blog, I’m sure you can’t possibly have enough time to read them, but anyway I’d just like to thank you for your hands tips – you also have a really nice looking site. I’m glad I’m on your mailing list and I can honestly say that yours if one of the few emails that actually teaches me something.

    All the best

  23. Cartuchos de ImpresoraBy Cartuchos de Impresora on 22 July, 2009

    Very nice tips !!!

  24. sathasivamBy sathasivam on 16 September, 2009

    Hi pl send full code