View: 3310|Reply: 0

PHP script to check Google backlinks and Google Index

[Copy link]
Posted on 5-6-2014 11:01:22 | Show all floors |Reading mode
  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.
  1. <?
  2. function GoogleBL($domain){
  3. $url="http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=link:".$domain."&filter=0";
  4. $ch=curl_init();
  5. curl_setopt($ch, CURLOPT_URL, $url);
  6. curl_setopt($ch, CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
  7. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  8. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  9. curl_setopt ($ch, CURLOPT_HEADER, 0);
  10. curl_setopt ($ch, CURLOPT_NOBODY, 0);
  11. curl_setopt($ch, CURLOPT_TIMEOUT, 30);
  12. $json = curl_exec($ch);
  13. curl_close($ch);
  14. $data=json_decode($json,true);
  15. if($data['responseStatus']==200)
  16. return $data['responseData']['cursor']['resultCount'];
  17. else
  18. return false;
  19. }
  20. ?>
Copy code
Save as: GoogleBLclass.php to count google backlink

  1. <?
  2. function GoogleIP($domain){
  3. $url="http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=site:".$domain."&filter=0";
  4. $ch=curl_init();
  5. curl_setopt($ch, CURLOPT_URL, $url);
  6. curl_setopt($ch, CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
  7. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  8. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  9. curl_setopt ($ch, CURLOPT_HEADER, 0);
  10. curl_setopt ($ch, CURLOPT_NOBODY, 0);
  11. curl_setopt($ch, CURLOPT_TIMEOUT, 30);
  12. $json = curl_exec($ch);
  13. curl_close($ch);
  14. $data=json_decode($json,true);
  15. if($data['responseStatus']==200)
  16. return $data['responseData']['cursor']['resultCount'];
  17. else
  18. return false;
  19. }
  20. ?>
Copy code
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.

  1. <?
  2. require("GoogleBLclass.php");
  3. require("GoogleIPclass.php");
  4. $domain="netdepviet.org"; //your domain name
  5. echo GoogleBL($domain); //get backlinks
  6. echo GoogleIP($domain); //get indexed page
  7. ?>
Copy code
All done . Have fun
Reply

Use item Report

You need to log in to reply. Login | Register

Points Rules for This Section

Theo dõi bản tin
Archiver|Mobile|Facebook|Contact|Netdepviet.org

Giữ gìn bản sắc dân tộc · Trân trọng quá khứ, hướng tới tương lai。

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

InThis boardPost
Kết nối Zalo
Back to top