Get output of library google pagerank checker

445 Views Asked by At

I use codeigniter and want use Google PageRank Checker (i get it from this site:Using PHP to retrieve the Google Pagerank of any domain) as library in codeigniter.

I done it in library as this(full code my library): http://pastebin.com/8TsiT9H4

Load this library in contorola as:

$this->load->library('googlepr');

And run it in view as following code:

$gpr = new GooglePR();
$pagerank = $gpr->getPagerank('http://www.domain.com');
echo $pagerank;

But it don't give me output, How can fix it and get output?

2

There are 2 best solutions below

1
On

I think you miss the PHP-Curl bindings

Install PHP-Curl and all should be good. Tips here

1
On

There is nothing to fix here unless you find what's wrong with that function:

function getPagerank($url) {
    $query = "http://toolbarqueries.google.com/search?client=navclient-auto&ch=" . $this->CheckHash($this->HashURL($url)) . "&features=Rank&q=info:" . $url . "&num=100&filter=0";
    echo "<br> query: $query </br>";
    $data = $this->file_get_contents_curl($query);
    $pos = strpos($data, "Rank_");
    echo "<br> pos: $pos </br>";
    if($pos !== false){
        $pagerank = substr($data, $pos + 9);
    echo "<br> pagerank: $pagerank </br>";      
        return trim($pagerank);
    }
}

It gives that output in my web server

query: http://toolbarqueries.google.com/search?client=navclient-auto&ch=791322981365&features=Rank&q=info:http://www.google.com&num=100&filter=0

pos: NULL

So, i think function is outdated.