PHP Backlink Checker

Posted in category Backlink, Snippets
Font Size
+ _ =

This function is usefull for peoples with a link directory where the links are stored inside a (MySQL) database. The PHP script is easy to use to find out if a reciprocal link still exists on the corresponding webpage. It takes care about the trailing slash in urls and can be used with (almost) every url. Inside the function is a check against a regular expression pattern and the result is a simple boolean.

CODE from: http://www.finalwebsites.com

<?php
function check_back_link($remote_url, $your_link) {
$match_pattern = preg_quote(rtrim($your_link, “/”), “/”);
$found = false;
if ($handle = @fopen($remote_url, “r”)) {
while (!feof($handle)) {
$part = fread($handle, 1024);
if (preg_match(“/<a(.*)href=[\"']“.$match_pattern.
“(\/?)[\"'](.*)>(.*)<\/a>/”, $part)) {
$found = true;
break;
}
}
fclose($handle);
}
return $found;
}
// example:
//if (check_back_link(“http://www.web-tool.ws”, “http://www.fixwordpress.net”)) echo “link exists”;
?>
You can leave a response, or trackback from your own site.

3 Responses to “PHP Backlink Checker”

  1. Home Cameras | Ryan says:

    May 23rd, 2009 at 8:57 am

    Thanks for codes but where is demo site address ?

  2. Buy Backlink says:

    June 13th, 2009 at 6:58 am

    thanks!You made some good points there. I did a search on the topic and found most people will agree with your blog.
    Thanks though, i’m glad some people share good stuff like this! It will greatly help me in my SEO activities.

  3. Swapnil says:

    December 24th, 2009 at 8:30 pm

    One of the most important factors in Search Engine Optimization is the number of incoming links to your website, the relevance of the website linking to you, the anchor text used for the link, and the page ranking of the webpage linking to you. We have tried it and have found it very useful to increase our page rank on google. We are a tender information portal, http://www.tradereader.com. We used tenders as our anchor text. We suggest any site to try and increase the backlinks.

Leave a Reply