Forum Moderators: coopster

Message Too Old, No Replies

How can I get Google Page Rank with Php?

         

tunayilmaz

2:31 pm on Jul 20, 2002 (gmt 0)



I am using Php, I want to show some webpages' PR to my clients.
Can I do this?

Brett_Tabke

12:35 pm on Jul 22, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Can't be done. Closest would be to cherry pick pages from the google odp directory.

andreasfriedrich

12:41 pm on Jul 22, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Configure your browser to use some kind of proxy for http. When using squid you need to change strip_query_terms to off in your squid.conf. This causes the query string to be logged.

Request the page you want to check once with your browser and the google toolbar enabled.

In your proxy log file look for a URL that looks like http://www.google.com/search?client=navclient-auto&ch=51313900179&q=info:http%3A%2F%2F [google.com]

Request that URL using php and parse the returned xml document looking for the element gsp/res/r/rk. Its contents is the page rank as displayed by the google toolbar.

Beware that you cannot change the q parameter in the query string to just any URL as the ch parameter seems to be connected to it. I havenīt tried to figure out what it is exactly.

Hope this helps.

[edited by: andreasfriedrich at 1:13 pm (utc) on July 22, 2002]

[edited by: jatar_k at 5:46 pm (utc) on Sep. 21, 2002]
[edit reason] fixed side scroll [/edit]

Brett_Tabke

12:55 pm on Jul 22, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Well, it _was_ a secret anyway ;)

EliteWeb

4:00 pm on Jul 22, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Packet Sniffing and Logs ;) Ah what fun!

andreasfriedrich

12:14 pm on Sep 15, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The above was my first post and I didnīt know the [ url ] code, so the above URL got messed up with the point at the end.

http://www.google.com/search?client=navclient-auto&ch=51313900179&q=info:http%3A%2F%2F [google.com]

[edited by: jatar_k at 5:44 pm (utc) on Sep. 21, 2002]
[edit reason] fixed side scroll [/edit]

martin

7:02 pm on Sep 17, 2002 (gmt 0)

10+ Year Member



Wow, great info. Thanks very much for that.

Very useful really as I only use Linux.

Where were you when I posted several requests for PageRank check through the Google API?

martin

7:26 pm on Sep 17, 2002 (gmt 0)

10+ Year Member



I was in a hurry to test that. Got a 403.

Is the ch site specific? Anybody with IE on Windows?

andreasfriedrich

8:02 pm on Sep 17, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In my ealier post I wrote

Beware that you cannot change the q parameter in the query string to just any URL as the ch parameter seems to be connected to it. I havenīt tried to figure out what it is exactly.

So short of having hacked that algo you need to request the url once from a windows box with the toolbar enabled. I believe the ch not only to be site specific but specific to each URL, some sort of hash value.

Andreas

martin

6:55 am on Sep 18, 2002 (gmt 0)

10+ Year Member



I hope it is site specific, I'll have some friend check that.

Thanks again for the valuable info.

martin

4:22 pm on Sep 21, 2002 (gmt 0)

10+ Year Member



What about this one?

[216.239.33.102...]

Results in something like:

Rank_1:1:4

Btw does ch change between updates.

(I think that Google can update the toolbar algo without requesting user confirmation.)

/edit
Removed non-necessary parts of the URI.

martin

2:42 pm on Sep 22, 2002 (gmt 0)

10+ Year Member



What user-agent, HTTP headers, etc. should I send to Google?

Should I act like it's the toolbar or try to identify myself (according to Google's robots.txt it is disallowed).

Whatever of these two I decide to do I think it will be illegal :-(

martin

2:50 pm on Sep 23, 2002 (gmt 0)

10+ Year Member



I found that all pages with a query string generate the same request for PageRank from the toolbar, ie.

www.example.com/?key=value1
www.example.com/?key=value2

have the same PageRank returned by the toolbar. It just requests the PageRank for www.example.com/?