Category Archives: Code

Search Engines Agree on Canonical Tag

Written by Omar Kattan. Filed under Code, SEO, Search News. No comments.
Canonical Tag to Deal with Duplicate Content

An agreement was struck yesterday by the three main search engines (Google, Yahoo and MSN) on the adoption of a new tag to tackle canonicalisation in the SERPs. Canonicalisation is the challenge of having multiple pages of the same page due to outdated software such as a content management system or forum. Examples of pages [...]

PHP Code to Grab Google PageRank

Written by Omar Kattan. Filed under Code. No comments.

Here is the code to grab Google pagerank for any website.  This can be very useful in Buzz Monitoring applications or tools that measure importance of backlinks (including competitors) Code: <?php   define(‘GOOGLE_MAGIC’, 0xE6359A60);   function _zeroFill($a, $b){     $z = hexdec(80000000);     if ($z & $a){       $a = ($a>>1);       $a &= (~$z); [...]

PHP Code to Grab Alexa Traffic Ranking

Written by Omar Kattan. Filed under Code. 1 Comment.

Here is a php code that lets you retrieve a website’s alexa ranking, useful in web applications that measure importance of webpages (such as bespoke link popularity tools). For this code snippet to work CURL library for php needs to be enabled on your server. Code:  <?php  function alexaRank($domain)  { $ch = curl_init(‘http://alexa.com/data/details/traffic_details?url=’.$domain);     curl_setopt($ch, CURLOPT_TIMEOUT, 50);     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);     curl_setopt($ch, CURLOPT_HEADER, 1);     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);     curl_setopt($ch, CURLOPT_USERAGENT, ”Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1″);     $curl_ret = curl_exec($ch); [...]

Favicon – that little added touch

Written by Omar Kattan. Filed under Code, Search Engine Marketing, Tips & Tricks. No comments.
An example of a favicon

Have you added a favicon to your site?  If you haven’t then this post will guide you through the simple process.  But before I start, let me explain what a favicon is.  A favicon is the little icon that shows up in the browser and tabs of your computer (depicted below).  It can distinguish your [...]

Inline Editing with Ajax

Written by Omar Kattan. Filed under Code. No comments.

Last week I came across a tutorial and code for inline editing using Ajax.  The reason I was looking for this sort of application was to implement a project management solution for one of my clients. What inline editing does is allow you to edit an online document on the fly using AJAX, PHP and MYSQL.  An [...]