- Impact
- 0
PHP:
<?php
$domain = "phpright.com"; // Domain to check backlinks
$url = "http://www.google.com/search?q=link%3A".$domain;
$file = file_get_contents($url);
if (!strstr($file,'did not match any documents')) {
$linksto = strstr($file,"of about <b>");
$linksto = substr($linksto,strlen("of about <b>"));
$linksto = str_replace(strstr($linksto,'</b>'),'',$linksto);
echo $linksto.' backlinks';
}
else
{
echo 'No backlinks';
}
?>
Thought this might be useful to some who want to make a simple backlink checker or just have a dynamic listing of their site's backlinks on their homepage. Just change the $domain variable and you're on your way.