Quên mật khẩu
 Register
Xem: 2982|Trả lời: 0

PHP script to check Google backlinks and Google Index

[Sao chép liên kết]
Đăng vào 5-6-2014 11:01:22 | Hiển thị tất cả tầng |Chế độ đọc
  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. ?>
Sao chép mã
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. ?>
Sao chép mã
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. ?>
Sao chép mã
All done . Have fun
Bạn cần đăng nhập để trả lời Đăng nhập | Register

Quy tắc tích điểm trong diễn đàn này

Archiver|Mobile|Youtube|Facebook|Twitter|Contact|Netdepviet.org

GMT+7, 4-12-2024 12:09 AM , Processed in 0.017268 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team

Trả lời nhanh Lên đầu trang Quay lại danh sách