Google Community Chat
 
PR PHP Tool not working.

You're visiting Google Community as a guest.
In order to post, you'll need to register and log in.

(If you were registered and logged in, these advertisements wouldn't be here)
Post new topic   Reply to topic    Google Community Forum Index // Web Design, Coding & Programming Forum
   
Author Message
colourbleu
Noogle
Noogle


Joined: 11 Aug 2005

187.35 GC$

Items

PostPosted: Thu Aug 11, 2005 2:55 am    Post subject: PR PHP Tool not working. Reply with quote
http://www.googlecommunity.com/scripts/google-pagerank.php
I have tried this script on different servers and still getting same error.

Parse error: parse error, unexpected T_VARIABLE in /webroot/a/p/aplac003/www/testpr.php on line 29

which is this bit of code,

    $z = hexdec(80000000);

Does anyone have any idea why this script does not work for me, when others seem to have it working?

I have tried it on 2 different servers.

Thanks for any ideas?


agent bleu
Back to top
View user's profile Send private message AIM Address
spence_noodle
Noogle
Noogle


Joined: 29 Sep 2005

250.85 GC$

Items

PostPosted: Thu Sep 29, 2005 3:15 am    Post subject: Reply with quote
has this been sorted?

if not post the code of the file on here. Wink
Back to top
View user's profile Send private message
colourbleu
Noogle
Noogle


Joined: 11 Aug 2005

187.35 GC$

Items

PostPosted: Thu Sep 29, 2005 4:24 am    Post subject: not sorted no Reply with quote
as I said the script is fine on a friends server but on my 2 i get the error.

here it is live

http://www.a-place-in-the-sun.com/testpr.php

error


Parse error: parse error, unexpected T_VARIABLE in /webroot/a/p/aplac003/www/testpr.php on line 29


line 29 =     $z = hexdec(80000000);

full code >=

<?php
// PHP Google PageRank Calculator Script
// -------------------------- April 2005
// Contact author: pagerankscript@googlecommunity.com

// for updates, visit:
// http://www.googlecommunity.com/scripts/google-pagerank.php

// provided by www.GoogleCommunity.com
//  an unofficial community of Google fans
// ---------------------------------------

// Instructions
//  Upload pagerank.php to your server
//  Call it like this: http://www.example.com/pagerank.php?url=http://www.yahoo.com/
//   example.com is your website. yahoo.com is the website to get the PR of
//  The code below displays the PR for $url

/*
    This code is released unto the public domain
*/
header("Content-Type: text/plain; charset=utf-8");

define('GOOGLE_MAGIC', 0xE6359A60);

//unsigned shift right
function zeroFill($a, $b)
{
    $z = hexdec(80000000);
        if ($z & $a)
        {
            $a = ($a>>1);
            $a &= (~$z);
            $a |= 0x40000000;
            $a = ($a>>($b-1));
        }
        else
        {
            $a = ($a>>$b);
        }
        return $a;
}

function mix($a,$b,$c) {
  $a -= $b; $a -= $c; $a ^= (zeroFill($c,13));
  $b -= $c; $b -= $a; $b ^= ($a<<Cool;
  $c -= $a; $c -= $b; $c ^= (zeroFill($b,13));
  $a -= $b; $a -= $c; $a ^= (zeroFill($c,12));
  $b -= $c; $b -= $a; $b ^= ($a<<16);
  $c -= $a; $c -= $b; $c ^= (zeroFill($b,5));
  $a -= $b; $a -= $c; $a ^= (zeroFill($c,3));   
  $b -= $c; $b -= $a; $b ^= ($a<<10);
  $c -= $a; $c -= $b; $c ^= (zeroFill($b,15));
   
  return array($a,$b,$c);
}

function GoogleCH($url, $length=null, $init=GOOGLE_MAGIC) {
    if(is_null($length)) {
        $length = sizeof($url);
    }
    $a = $b = 0x9E3779B9;
    $c = $init;
    $k = 0;
    $len = $length;
    while($len >= 12) {
        $a += ($url[$k+0] +($url[$k+1]<<Cool +($url[$k+2]<<16) +($url[$k+3]<<24));
        $b += ($url[$k+4] +($url[$k+5]<<Cool +($url[$k+6]<<16) +($url[$k+7]<<24));
        $c += ($url[$k+8] +($url[$k+9]<<Cool +($url[$k+10]<<16)+($url[$k+11]<<24));
        $mix = mix($a,$b,$c);
        $a = $mix[0]; $b = $mix[1]; $c = $mix[2];
        $k += 12;
        $len -= 12;
    }

    $c += $length;
    switch($len)              /* all the case statements fall through */
    {
        case 11: $c+=($url[$k+10]<<24);
        case 10: $c+=($url[$k+9]<<16);
        case 9 : $c+=($url[$k+8]<<Cool;
          /* the first byte of c is reserved for the length */
        case 8 : $b+=($url[$k+7]<<24);
        case 7 : $b+=($url[$k+6]<<16);
        case 6 : $b+=($url[$k+5]<<Cool;
        case 5 : $b+=($url[$k+4]);
        case 4 : $a+=($url[$k+3]<<24);
        case 3 : $a+=($url[$k+2]<<16);
        case 2 : $a+=($url[$k+1]<<Cool;
        case 1 : $a+=($url[$k+0]);
         /* case 0: nothing left to add */
    }
    $mix = mix($a,$b,$c);
    /*-------------------------------------------- report the result */
    return $mix[2];
}

//converts a string into an array of integers containing the numeric value of the char
function strord($string) {
    for($i=0;$i<strlen($string);$i++) {
        $result[$i] = ord($string{$i});
    }
    return $result;
}

function getrank($url) {
    $url = 'info:'.$url;
    $ch = GoogleCH(strord($url));
    $file = "http://www.google.com/search?client=navclient-auto&ch=6$ch&features=Rank&q=$url";
    $data = file($file);
    $rankarray = explode (':', $data[2]);
    $rank = $rankarray[2];
    return $rank;
}

echo 'PageRank: '.getrank($_REQUEST["url"]).'<br /><small>provided by <a href="http://www.googlecommunity.com/" target="_blank">Google Community.com</a></small>';

?>

I have no idea what the problem is, but i suspect something in the php settings. I have no access to the php.ini on my server.

a work around would be fab, since im sure i could find some fancy uses for such a script.

bleu
Back to top
View user's profile Send private message AIM Address
spence_noodle
Noogle
Noogle


Joined: 29 Sep 2005

250.85 GC$

Items

PostPosted: Thu Sep 29, 2005 4:40 am    Post subject: Reply with quote
it could be this line:

Code:
header("Content-Type: text/plain; charset=utf-8");


Place // in front of it, like this:

Code:
//header("Content-Type: text/plain; charset=utf-8");
Back to top
View user's profile Send private message
dc
Noogle
Noogle


Joined: 11 Oct 2005
Location: romania
429.20 GC$

Items

PostPosted: Thu Oct 13, 2005 6:47 am    Post subject: Reply with quote
you may want to enclose that code into double quotes at line 29:
Code:

    $z = hexdec(80000000);

like this:
Code:

    $z = hexdec("80000000");

as it says at http://ro2.php.net/manual/en/function.hexdec.php
Back to top
View user's profile Send private message Yahoo Messenger
Pixel
Retired Moderator
Platinum Member


Joined: 18 Sep 2004

10851.50 GC$

Items

PostPosted: Thu Oct 13, 2005 8:37 am    Post subject: Reply with quote
If none of this works, PM intelliot, he should know.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address MSN Messenger
Sponsored Links
Posted: 9 Jan 2009 1:35 am    Post subject: Advertisements
Back to top
Post new topic   Reply to topic    Google Community Forum Index // Web Design, Coding & Programming Forum All times are GMT - 8 Hours
Page 1 of 1


 
Jump to:  
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

© 2005-2006 Google Community

Powered by phpBB

Privacy Policy | Contact Us

Powered by Google Search blog

This website is not affiliated in any way with Google, Inc.
Google™ is a registered trademark of Google, Inc.