netdepviet Đăng vào 5-6-2014 11:01:22

PHP script to check Google backlinks and Google Index

As a super webmaster you'll really need to know your website statistic : Google PR, Google backlinks, Google Index. The following php scripts will help you to count google backlink, google index.<?
function GoogleBL($domain){
$url="http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=link:".$domain."&filter=0";
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt ($ch, CURLOPT_NOBODY, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$json = curl_exec($ch);
curl_close($ch);
$data=json_decode($json,true);
if($data['responseStatus']==200)
return $data['responseData']['cursor']['resultCount'];
else
return false;
}
?>Save as: GoogleBLclass.php to count google backlink
<?
function GoogleIP($domain){
$url="http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=site:".$domain."&filter=0";
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt ($ch, CURLOPT_NOBODY, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$json = curl_exec($ch);
curl_close($ch);
$data=json_decode($json,true);
if($data['responseStatus']==200)
return $data['responseData']['cursor']['resultCount'];
else
return false;
}
?>
Save as GoogleIPclass.php to count google index page.

Now this is your own website tool to count your website Google back links and indexed page.
<?
require("GoogleBLclass.php");
require("GoogleIPclass.php");
$domain="netdepviet.org"; //your domain name
echo GoogleBL($domain); //get backlinks
echo GoogleIP($domain); //get indexed page
?>
All done . Have fun :)
Trang: [1]
Xem phiên bản đầy đủ: PHP script to check Google backlinks and Google Index