How to check Link popularity or back links for a domain in php

Tuesday, April 20, 2010 5:06
Posted in category PHP

How to check Link popularity or back links for a given domain in php?

Link popularity is a measure of the quantity and quality of other web sites that link to a specific site on the World Wide Web. It is an example of the move by search engines towards off-the-page-criteria to determine quality content. In theory, off-the-page-criteria adds the aspect of impartiality to search engine rankings. Link popularity plays an important role in the visibility of a web site among the top of the search results. Indeed, some search engines require at least one or more links coming to a web site, otherwise they will drop it from their index.

Search engines such as Google use a special link analysis system to rank web pages. Citations from other WWW authors help to define a site’s reputation. The philosophy of link popularity is that important sites will attract many links. Content-poor sites will have difficulty attracting any links. Link popularity assumes that not all incoming links are equal, as an inbound link from a major directory carries more weight than an inbound link from an obscure personal home page. In other words, the quality of incoming links counts more than sheer numbers of them.

We can know Link popularity in google and Yahoo for given domain name in PHP.

It can be achievd by some simple logic and here is that logic for you.

</span>

<?php
// Setting the URL variable
$link = $_POST['url'];

// Google Backlinks
function fetch_google($uri) {
$uri = trim(eregi_replace('http://', '', $uri)); $uri = trim(eregi_replace('http', '', $uri));
$url = 'http://www.google.com/search?hl=en&amp;amp;lr=&amp;amp;ie=UTF-8&amp;amp;q=links:'.$uri;
$v = file_get_contents($url);
preg_match('/of about \<b\>(.*?)\<\/b\>/si',$v,$r);
return ($r[1]) ? $r[1] : '0';
}

// Yahoo Inlinks
function fetch_yahoo($uri) {
$uri = trim(eregi_replace('http://', '', $uri)); $uri = trim(eregi_replace('http', '', $uri));
$url = 'http://siteexplorer.search.yahoo.com/search?p=http://'.$uri.'&amp;amp;bwm=i&amp;amp;bwmf=s&amp;amp;bwmo=&amp;amp;fr2=seo-rd-se';
$v = file_get_contents($url);

preg_match('/Inlinks \((.*?)\)/si',$v,$r);
return ($r[1]) ? $r[1] : '0';
}

// Alexa Rating
function fetch_alexa($uri){
$uri = trim(eregi_replace('http://', '', $uri)); $uri = trim(eregi_replace('http', '', $uri));
$url = 'http://data.alexa.com/data?cli=10&amp;amp;dat=snbamz&amp;amp;url=' . urlencode($uri);
$v = file_get_contents($url);
preg_match('/\<popularity url\="(.*?)" TEXT\="([0-9]+)"\/\>/si', $v, $r);
return ($r[2]) ? $r[2] : '0';
}

// Page Header
echo "<h2>Search Engine Popularity</h2>";

// Display Links and Information
if (isset($link)) {
echo "<strong>URL:</strong> " . $link . "<br />";
echo "<strong>Google Backlinks:</strong> " . fetch_google($link) . "<br />";
echo "<strong>Yahoo Backlinks:</strong> " . fetch_yahoo($link) . "<br />";
echo "<strong>Alexa Rating:</strong> " . fetch_alexa($link) . "<br />";
}

// Search Form
echo "<br />
<form action=\"<?=$_SERVER['PHP_SELF'];?>\" method=\"POST\">
<input type=\"text\" name=\"url\" />
<input type=\"submit\" />
</form>";

?>

<span>
You can leave a response, or trackback from your own site.

2 Responses to “How to check Link popularity or back links for a domain in php”

  1. bowtrol says:

    April 21st, 2010 at 9:01 am

    Fantastic website you have going here. Just wanted to say that we throughly enjoyed your comment. Any chance of getting a copy of the theme? Hehe

  2. Eddie D. Thomas says:

    April 21st, 2010 at 12:33 pm

    Informative article about internet marketing, thanks for sharing with us. Internet is the best media to enlarge your business if we use it in a proper way.

Leave a Reply