| |
CossackSoft Noogle

Joined: 14 Aug 2005 Location: Canada 167.40 GC$
Items
|
Posted: Sun Aug 14, 2005 3:52 pm Post subject: GoogleCommunity PR Script - error with Yahoo |
|
|
|
Hi,
I am developing a web browser and I asked the "Google Technician" if I could use this script to make a PR bar on my browser. I got the go ahead and was invited to these forums. Anyways, the script works flawlessly for the most part. However there is a problem - and it seems it is only with the Yahoo search engine - when you search for certain keywords, the search result page gives an error on the PR Script. For example, when I search for "mouse" on Yahoo, the result page returns a PR of 0 which is right, but if I search for "mouse game" than the PR script returns the following error:
| Code: | | Warning: file(http://www.google.com/search?client=navclient-auto&ch=6-1415330732&features=Rank&q=info:http://search.yahoo.com/search?p=mouse game): failed to open stream: HTTP request failed! in /home/weightl/public_html/cossacksoft-com/pagerank.php on line 126 |
Line 126 is this: | Code: | | $data = file($file); |
Anyone have any clue why it is doing this? It seems the error comes when you search Yahoo for 2 keyword phrase or more. I would appreciate any help to fix this.
Thanks.
BTW, here is a screen shot of the PR Bar on my browser that uses the GoogleCommunity script!
http://www.cossacksoft.com/imghost/uploads/09a7355784.jpg _________________ CossackSoft - www.cossacksoft.com |
|
| Back to top |
|
|
darrenstraight Site Admin & Platinum Member


Joined: 25 Jul 2004 Location: England 173385.09 GC$
Items
|
Posted: Sun Aug 14, 2005 4:08 pm Post subject: |
|
|
|
I'm not on my desktop Pc at the moment as I'm on my Pda, so unfortunately I cant look into your problem at the moment, hopefully somebody will give you a better answer than mine before I do. _________________ My Blog | Microsoft Discussion |
|
| Back to top |
|
|
64bitguy Noogle

Joined: 14 Jul 2005
225.55 GC$
Items
|
Posted: Sat Sep 24, 2005 9:19 am Post subject: |
|
|
|
I have the same problem simply using the pagerank.php tool (script here at the Google Community) on my domain.
I get that exact same error whenever I try to run it.
| Quote: | | Warning: file_get_contents(http://www.google.com/search?client=navclient-auto&ch=6$ch&features=Rank&q=$url): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden in /home/public_html/pagerank.php on line 109 |
Line 109=:
| Code: | | $data = file($file); |
Any ideas on what the problem is would be GREATLY appreciated. |
|
| Back to top |
|
|
spence_noodle Noogle

Joined: 29 Sep 2005
250.85 GC$
Items
|
Posted: Thu Sep 29, 2005 3:12 am Post subject: |
|
|
|
we need to see the code of the php file.  |
|
| Back to top |
|
|
surveysgate Noogle

Joined: 17 Oct 2005
142.30 GC$
Items
|
Posted: Mon Oct 17, 2005 1:15 am Post subject: Re: GoogleCommunity PR Script - error with Yahoo |
|
|
|
| CossackSoft wrote: | Hi,
I am developing a web browser and I asked the "Google Technician" if I could use this script to make a PR bar on my browser. I got the go ahead and was invited to these forums. Anyways, the script works flawlessly for the most part. However there is a problem - and it seems it is only with the Yahoo search engine - when you search for certain keywords, the search result page gives an error on the PR Script. For example, when I search for "mouse" on Yahoo, the result page returns a PR of 0 which is right, but if I search for "mouse game" than the PR script returns the following error:
| Code: | | Warning: file(http://www.google.com/search?client=navclient-auto&ch=6-1415330732&features=Rank&q=info:http://search.yahoo.com/search?p=mouse game): failed to open stream: HTTP request failed! in /home/weightl/public_html/cossacksoft-com/pagerank.php on line 126 |
Line 126 is this: | Code: | | $data = file($file); |
Anyone have any clue why it is doing this? It seems the error comes when you search Yahoo for 2 keyword phrase or more. I would appreciate any help to fix this.
Thanks.
BTW, here is a screen shot of the PR Bar on my browser that uses the GoogleCommunity script!
http://www.cossacksoft.com/imghost/uploads/09a7355784.jpg |
GOOGLE guys have performed a good work while creating PHP API for retrieving page rating. But it looks like only plain URLs have been tested for it.
You have to a little modify your copy of the script in this way:
function getrank($url) {
$ch_url = 'info:'.$url;
$ch = GoogleCH(strord($ch_url));
$url = 'info:' . urlencode($url);
$file = "http://www.google.com/search?client=navclient-auto&ch=6$ch&features=Rank&q=$url";
$data = file($file);
if ($data === false)
return -1;
$rankarray = explode (':', $data[2]);
if ($rankarray == null || count($rankarray) < 3)
return -1;
$rank = $rankarray[2];
if ($rank != null)
{
$rank = trim($rank);
$rank = intval($rank);
}
else
$rank = 0;
return $rank;
}
urlencode PHP function escapes the special symbol at 'url' parameter.
Good luck. _________________ Paid Surveys Online Directory Paid survey guidelines, FAQs and useful tips on boosting your online revenue. Rresource you need to start making money by taking online paid surveys! All is free. |
|
| Back to top |
|
|
REMIYA Noogle

Joined: 19 Nov 2005
107.70 GC$
Items
|
Posted: Sat Nov 19, 2005 9:57 pm Post subject: Re: GoogleCommunity PR Script - error with Yahoo |
|
|
|
| surveysgate wrote: |
You have to a little modify your copy of the script in this way:
function getrank($url) {
$ch_url = 'info:'.$url;
$ch = GoogleCH(strord($ch_url));
$url = 'info:' . urlencode($url);
$file = "http://www.google.com/search?client=navclient-auto&ch=6$ch&features=Rank&q=$url";
$data = file($file);
if ($data === false)
return -1;
$rankarray = explode (':', $data[2]);
if ($rankarray == null || count($rankarray) < 3)
return -1;
$rank = $rankarray[2];
if ($rank != null)
{
$rank = trim($rank);
$rank = intval($rank);
}
else
$rank = 0;
return $rank;
}
urlencode PHP function escapes the special symbol at 'url' parameter.
Good luck. |
First to say. It is not only an Yahoo problem.
The script works fine on my local server, however it continues NOT to work on the Internet server. I have tried the previous version, and the current vesrion. I even found a very old version of the script using fopen.
It looks like the problem is somewhere in the server configuration. Any hints? |
|
| Back to top |
|
|
REMIYA Noogle

Joined: 19 Nov 2005
107.70 GC$
Items
|
Posted: Sat Nov 19, 2005 10:17 pm Post subject: Success |
|
|
|
I succeeded resolving the problem. Just swithing my server to PHP5 with it's confuguration made my script run flawlessly.
In case somebody is curious, see it running here. |
|
| Back to top |
|
|
Sponsored Links
|
Posted: 23 Nov 2008 6:56 am Post subject: Advertisements |
|
|
|
|
|
|
| Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Host your free forums with Invision Plus.net forum web hosting with your own subdomain.
alexisBlue v1.2 // Theme Created By: Andrew Charron // Icons in Part By: Travis Carden
|
|
|
|
|