/
get-google-pagerank.php
36 lines (32 loc) · 1.33 KB
/
get-google-pagerank.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
/**
* SEOstats Example - Get Google PageRank
*
* @package SEOstats
* @author Stephan Schmitz <eyecatchup@gmail.com>
* @copyright Copyright (c) 2010 - present Stephan Schmitz
* @license http://eyecatchup.mit-license.org/ MIT License
* @updated 2013/12/04
*/
// NOTE: The given path to the autoload.php assumes that you installed SEOstats via composer
// and copied this example file from ./vendor/seostats/seostats/example/example.php to ./example.php
//
// If you did NOT installed SEOstats via composer but instead downloaded the zip file from github.com,
// you need to follow this steps:
//
// 1. Comment-in line 24 (remove hash char "#") and comment-out line 25 (prepend hash char "#")
// 2. Copy this example file (and the others) from ./example/example.php to ./example.php
//
// For further reference see: https://github.com/eyecatchup/SEOstats/issues/49
// Bootstrap the library / register autoloader
#require_once realpath(__DIR__ . '/SEOstats/bootstrap.php');
require_once realpath(__DIR__ . '/vendor/autoload.php');
try {
$url = testURL;
// Get the Google PageRank for the given URL.
$pagerank = \SEOstats\Services\Google::getPageRank($url);
echo "The current Google PageRank for {$url} is {$pagerank}." . PHP_EOL;
}
catch (\Exception $e) {
echo 'Caught SEOstatsException: ' . $e->getMessage();
}