Home php教程 php手册 php实现获取网站PR值功能

php实现获取网站PR值功能

Jun 21, 2016 am 08:50 AM
check quot string

最近一直在忙友链,也乘机学习一下PR值相关知识,试着用PHP实现PR查询。

Google PR值是什么在此不做过多的介绍,简单的说就是你的PR值越高代表的你网站越重要越受欢迎,不过这个值最高为10,下面这个代码可以获得一个网站的PR值。
  用PHP脚本程序获取网站的PR值的主要代码如下:
  程序如下:   $googlehost="toolbarqueries.google.com";
  $googleua="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5";
  echo getpr
  //convert a string to a 32-bit integer
  function StrToNum($Str, $Check, $Magic) {
  $Int32Unit = 4294967296; // 2^32
  $length = strlen($Str);
  for ($i = 0; $i   $Check *= $Magic;
  //If the float is beyond the boundaries of integer (usually +/- 2.15e+9 = 2^31),
  // the result of converting to integer is undefined
  // refer to php.net/manual/en/language.types.integer.php
  if ($Check >= $Int32Unit) {
  $Check = ($Check - $Int32Unit * (int) ($Check / $Int32Unit));
  //if the check less than -2^31
  $Check = ($Check   }
  $Check += ord($Str{$i});
  }
  return $Check;
  }
  //genearate a hash for a url
  function HashURL($String) {
  $Check1 = StrToNum($String, 0×1505, 0×21);
  $Check2 = StrToNum($String, 0, 0×1003F);
  $Check1 》= 2;
  $Check1 = (($Check1 》 4) & 0×3FFFFC0 ) ($Check1 & 0×3F);
  $Check1 = (($Check1 》 4) & 0×3FFC00 ) ($Check1 & 0×3FF);
  $Check1 = (($Check1 》 4) & 0×3C000 ) ($Check1 & 0×3FFF);
  $T1 = (((($Check1 & 0×3C0) 《 4) ($Check1 & 0×3C)) 《2 ) ($Check2 & 0xF0F );
  $T2 = (((($Check1 & 0xFFFFC000) 《 4) ($Check1 & 0×3C00)) 《 0xA) ($Check2 & 0xF0F0000 );
  return ($T1 $T2);
  }
  //genearate a checksum for the hash string
  function CheckHash($Hashnum) {
  $CheckByte = 0;
  $Flag = 0;
  $HashStr = sprintf(‘%u’, $Hashnum) ;
  $length = strlen($HashStr);
  for ($i = $length - 1; $i >= 0; $i –) {
  $Re = $HashStr{$i};
  if (1 === ($Flag % 2)) {
  $Re += $Re;
  $Re = (int)($Re / 10) + ($Re % 10);
  }
  $CheckByte += $Re;
  $Flag ++;
  }
  $CheckByte %= 10;
  if (0 !== $CheckByte) {
  $CheckByte = 10 - $CheckByte;
  if (1 === ($Flag % 2) ) {
  if (1 === ($CheckByte % 2)) {
  $CheckByte += 9;
  }
  $CheckByte 》= 1;
  }
  }
  return "7".$CheckByte.$HashStr;
  }



Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

17 ways to solve the kernel_security_check_failure blue screen 17 ways to solve the kernel_security_check_failure blue screen Feb 12, 2024 pm 08:51 PM

Kernelsecuritycheckfailure (kernel check failure) is a relatively common type of stop code. However, no matter what the reason is, the blue screen error causes many users to be very distressed. Let this site carefully introduce 17 types to users. Solution. 17 solutions to kernel_security_check_failure blue screen Method 1: Remove all external devices When any external device you are using is incompatible with your version of Windows, the Kernelsecuritycheckfailure blue screen error may occur. To do this, you need to unplug all external devices before trying to restart your computer.

Convert basic data types to strings using Java's String.valueOf() function Convert basic data types to strings using Java's String.valueOf() function Jul 24, 2023 pm 07:55 PM

Convert basic data types to strings using Java's String.valueOf() function In Java development, when we need to convert basic data types to strings, a common method is to use the valueOf() function of the String class. This function can accept parameters of basic data types and return the corresponding string representation. In this article, we will explore how to use the String.valueOf() function for basic data type conversions and provide some code examples to

How to convert char array to string How to convert char array to string Jun 09, 2023 am 10:04 AM

Method of converting char array to string: It can be achieved by assignment. Use {char a[]=" abc d\0efg ";string s=a;} syntax to let the char array directly assign a value to string, and execute the code to complete the conversion.

How to turn off Palm Check in Windows 11/10 How to turn off Palm Check in Windows 11/10 Feb 19, 2024 pm 09:45 PM

This article will guide you to turn off the PalmCheck function on Windows 11/10 PC. PalmCheck is a feature designed to prevent accidental palm or other touches from being mistakenly recognized as input when typing on the keyboard. This is usually found in touchpad settings, especially on touch-enabled devices like laptops. Sometimes you may want to turn off PalmCheck or a similar feature to give you more flexibility in controlling input in situations where you need to use both the keyboard and touchpad. In this article, we will introduce how to disable PalmCheck function on Windows 11/10 PC, so that you can better cope with the needs when gaming or running applications. What is the P on the touchpad?

Use Java's String.replace() function to replace characters (strings) in a string Use Java's String.replace() function to replace characters (strings) in a string Jul 25, 2023 pm 05:16 PM

Replace characters (strings) in a string using Java's String.replace() function In Java, strings are immutable objects, which means that once a string object is created, its value cannot be modified. However, you may encounter situations where you need to replace certain characters or strings in a string. At this time, we can use the replace() method in Java's String class to implement string replacement. The replace() method of String class has two types:

2w words detailed explanation String, yyds 2w words detailed explanation String, yyds Aug 24, 2023 pm 03:56 PM

Hello everyone, today I will share with you the basic knowledge of Java: String. Needless to say the importance of the String class, it can be said to be the most used class in our back-end development, so it is necessary to talk about it.

Use java's String.length() function to get the length of a string Use java's String.length() function to get the length of a string Jul 25, 2023 am 09:09 AM

Use Java's String.length() function to get the length of a string. In Java programming, string is a very common data type. We often need to get the length of a string, that is, the number of characters in the string. In Java, we can use the length() function of the String class to get the length of a string. Here is a simple example code: publicclassStringLengthExample{publ

Golang function byte, rune and string type conversion skills Golang function byte, rune and string type conversion skills May 17, 2023 am 08:21 AM

In Golang programming, byte, rune and string types are very basic and common data types. They play an important role in processing data operations such as strings and file streams. When performing these data operations, we usually need to convert them to each other, which requires mastering some conversion skills. This article will introduce the byte, rune and string type conversion techniques of Golang functions, aiming to help readers better understand these data types and be able to apply them skillfully in programming practice.

See all articles