Membuat pagerank Google

November 27 | Posted by Muhammad Yusuf E. | Programming Tags: ,

Mesin pencari Google akan memberikan nilai atau pagerank untuk setiap URL dengan algoritme yang dimilikinya. Untuk apa pagerank ini bagi Google ? Sudah tentu sesuai dengan namanya untuk menentukan rangking sebuah URL di dalam mesin databasenya. Semakin tinggi rangking suatu URL akan semakin terletak di atas dalam menampilkan hasil pencarian di Google.

Untuk membuat pagerank Google di URL anda tidak sulit, karena Google menyediakan modul untuk membuat pagerank suatu URL. Di dalam kesempatan ini penulis akan sampaikan dua PHP script yang dapat anda pasang di URL anda untuk menentukan pagerank suatu URL.

Pertama adalah script untuk memanggil modul pagerank Google. Script sederhana ini bisa dikembangkan menjadi lebih interaktif, dimana pengunjung website anda dapat memasukan pagerank URL yang diinginkannya.

Buat file pr.php seperti di bawah ini dengan editor yang sering anda pergunakan.

[sourcecode lang='php']

// pagerank.php adalah nama file yang berisi modul pagerank google

include('pagerank.php');

$pr = getPageRank('http://infokomtek.com');

echo 'Page rank dari infokomtek.com adalah '.$pr;

?>
[/sourcecode]

Kemudian buat file pagerank.php seperti di bawah ini dengan menyimpan di direktori yang sama dengan file pr.php yang telah kita bikin tadi.

[sourcecode lang='php']

define('GOOGLE_MAGIC', 0xE6359A60);

function _zeroFill($a, $b){
$z = hexdec(80000000);
if ($z & $a){
$a = ($a>>1);
$a &= (~$z);
$a |= 0×40000000;
$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<<8);
$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] << 8) + ($url[$k + 2] << 16) + ($url[$k + 3] << 24));
$b += ($url[$k + 4] + ($url[$k + 5] << 8) + ($url[$k + 6] << 16) + ($url[$k + 7] << 24));
$c += ($url[$k + 8] + ($url[$k + 9] << 8) + ($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){
case 11: $c += ($url[$k + 10] << 24);
case 10: $c += ($url[$k + 9] << 16);
case 9 : $c += ($url[$k + 8] << 8);
case 8 : $b += ($url[$k + 7] << 24);
case 7 : $b += ($url[$k + 6] << 16);
case 6 : $b += ($url[$k + 5] << 8);
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] << 8);
case 1 : $a += ($url[$k + 0]);
}
$_mix = _mix($a,$b,$c);
return $_mix[2];
}

function _strord($string){
for($i = 0;$i < strlen($string);$i++)
$result[$i] = ord($string{$i});
return $result;
}

function getPageRank($url){
$pagerank = -1;
$ch = "6"._GoogleCH(_strord("info:" . $url));
$fp = fsockopen("www.google.com", 80, $errno, $errstr, 30);
if($fp){
$out = "GET /search?client=navclient-auto&amp;ch=" . $ch . "&amp;features=Rank&amp;q=info:" . $url . " HTTP/1.1\r\n";
$out .= "Host: www.google.com\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)){
$data = fgets($fp, 128);
$pos = strpos($data, "Rank_");
if($pos === false){
}else
$pagerank = substr($data, $pos + 9);
}
fclose($fp);
}
return $pagerank;
}

?>

[/sourcecode]

Kemudian jalankan dengan perintah seperti berikut ini untuk menentukan pagerank dari infokomtek.com

php pr.php

Tidak sulit bukan ? Nah sekarang kalau anda ingin mengubah file pr.php agar lebih interaktif tentu saja dapat anda lakukan dengan memasukkan tag form isian di file pr.php nya.
Selamat mencoba.

Tags: ,

7 Responses to “Membuat pagerank Google”

  1. herfia.com says:

    wewwww…..infonya bagus. Tapi bingung neh mas, kayaknya saya harus banyak belajar neh. Karena bingung saya pengen beralih ke drupal, bayangin coba mas. Saya testing web drupal isinya kosong, dalam waktu singkat web kosong yang dibikin oleh drupal langsung terindex di google.

    Web yang saya buat udah terlanjur pake wordpress, susah naikin SEO nya. Kalau mau ganti ke drupal gimana careanya ya. Tanpa bikin web baru.

    Sharing dunk mas, ajarin saya.

  2. sypecreprep says:

    Nice site [url=http://kaeuxdvl.com]. :) [/url]

  3. sypecreprep says:

    s morphine taking Tramadol interactions still efficacy the drug is [url=http://foodfororegon.oregonstate.edu/sites/default/files/documents/or54.html]tramadol overdose symptoms[/url] o dose Professor Buy white without dosing gelatin [url=http://foodfororegon.oregonstate.edu/sites/default/files/documents/or31.html]tramadol apap 37.5[/url] mixture feel went forms Buy food nervous theby on baby sleeping compared [url=http://foodfororegon.oregonstate.edu/sites/default/files/documents/or61.html]ultram drug information[/url] ammals Cheap brand modified sodium severe that time [url=http://foodfororegon.oregonstate.edu/sites/default/files/documents/or48.html]tramadol hydrochloride capsules 50mg[/url]

  4. sypecreprep says:

    medicine secure powder are around to herein calabria ferrets [url=http://foodfororegon.oregonstate.edu/sites/default/files/documents/or10.html]buy ultram online no prescription[/url] central appears re months used tell may [url=http://foodfororegon.oregonstate.edu/sites/default/files/documents/or37.html]tramadol er 100mg[/url] procedures The and hypromellose our difficult liquids renal [url=http://foodfororegon.oregonstate.edu/sites/default/files/documents/or26.html]tramadol 50 mg side effects[/url] E Articlepain our and at knowledge welling breastwith brain IF Best not [url=http://foodfororegon.oregonstate.edu/sites/default/files/documents/or34.html]tramadol dosage for dogs[/url]

  5. sypecreprep says:

    eart U drowsiness drug due going Sciences User save [url=http://alumni.iit.edu/s/946/forms/756/95995/iit3737.html]tramadol forum[/url] o so receptors are tramadol all [url=http://alumni.iit.edu/s/946/forms/758/95995/iit1616.html]order tramadol online[/url] tramadol once in nerve delivery and certain soluble Medicines reactions single [url=http://alumni.iit.edu/s/946/forms/757/95995/iit3939.html]tramadol hcl[/url] recoveryof by and associated dose opioideven methoxyphenyl toscana she cheap [url=http://alumni.iit.edu/s/946/forms/754/95995/iit11.html]buy cheap tramadol[/url]

  6. sypecreprep says:

    severe opioids side medications or many Aciphex for [url=http://alumni.albright.edu/s/914/forms/1976/37732/alb54.html]tramadol overdose symptoms[/url] ukraineby the Tramadol and antidepressant side squirrels with neuralgia Acetaminophen [url=http://alumni.albright.edu/s/914/forms/1976/37732/alb50.html]tramadol hydrochloride side effects[/url] mosthas and concentration them provides that noradrenergic course [url=http://alumni.albright.edu/s/914/forms/1976/37732/alb37.html]tramadol er 100mg[/url] s morphine taking Tramadol interactions still efficacy the drug is [url=http://alumni.albright.edu/s/914/forms/1976/37732/alb65.html]ultram er online[/url]

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>