Browse | Submit A New Snippet | Create A Package

SEO tools - Pagerank snippet

Type:
Sample Code (HOWTO)
Category:
HTML Manipulation
License:
GNU General Public License
Language:
PHP

Description:
Une snippet (utilisé pour référencer http://taichiyang.org à tester sur http://taichiyang.org/test/index.php) qui permet de lister des pages rank google ainsi que les backlinks yahoo.

Versions Of This Snippet:

Snippet ID Download Version Date Posted Author Delete
80.0.12010-01-15 15:55Charles Dumont

Download a raw-text version of this code by clicking on "Download Version"

 


Latest Snippet Version: 0.0.1

Here is an extract of the code. I have to clean it and improve it and in 0.0.2, all the code will be published. <?php @set_time_limit(0); @include 'fonctions_google_pr.php'; $c=9; $api_id='YahooDemo'; $pays = $_POST['country']; if ( (isset($_POST['kw1']))&& ($_POST['kw1']!='') ) { switch($pays) { case 1 : $ndd = "fr"; $lang = "fr"; break; case 2 : $ndd = "com"; $lang = "en"; break; case 3 : $ndd = "es"; $lang = "es"; break; case 4 : $ndd = "it"; $lang = "it"; break; case 5 : $ndd = "de"; $lang = "de"; break; case 6 : $ndd = "be"; $lang = "be"; break; case 7 : $ndd = "pt"; $lang = "pt"; break; case 8 : $ndd = "cn"; $lang = "cn"; break; case 9 : $ndd = "co.uk"; $lang = "en"; break; case 10 : $ndd = "co.jp"; $lang = "ja"; break; case 11 : $ndd = "ch"; $lang = "fr"; break; case 12 : $ndd = "ca"; $lang = "fr"; break; case 13 : $ndd = "ru"; $lang = "ru"; break; } $kw=trim(strip_tags($_POST['kw1'])); $ch = curl_init(); echo "<p><strong>Cliquer sur le titre des colonnes pour classer soit par PR soit par position</strong></p>"; echo "<br /><h3>Mot-clé : ",$kw,"</h3>"; echo "<h6>Résultats Google</h6>"; $pagenum = 0; $googlefrurl = "http://www.google." . $ndd . "/search?hl=" . $lang . "&q=" . urlencode($kw) . "&start=$pagenum"; echo ("<p>Site : <strong>Google.".$ndd."</strong></p>"); echo '<table id="test1" cellpadding="0" cellspacing="0" border="0" class="rowstyle-alt colstyle-alt no-arrow"><thead><tr>'; echo '<th class="sortable-numeric">Position sur Google</th>'; echo '<th class="sortable-text">Url</th>'; echo '<th class="sortable-numeric">Pagerank</th>'; if ($_POST['liens_yahoo']=='oui') { echo '<th class="sortable-numeric">Yahoo Backlinks</th>'; } echo '</tr></thead><tbody>'; while($pagenum <= $c) { if (function_exists('curl_init')) { curl_setopt($ch, CURLOPT_USERAGENT, $GLOBALS['useragent']); curl_setopt($ch, CURLOPT_URL,$googlefrurl); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $result=curl_exec ($ch); } else { $result= file_get_contents($googlefrurl); } preg_match_all('/<h3 class=r><a href="(.*?)"/si', $result, $matches); $i = 0; $n = count($matches[1]); $pagenum++; $pagenum2 = $pagenum.'0'; $googlefrurl = "http://www.google." . $ndd . "/search?hl=" . $lang . "&q=" . urlencode($kw) . "&start=$pagenum2&safe=off&pwst=1&filter=0"; while($i < $n) { $url_new = trim($matches[1][$i]); $rs_pr = pagerank($url_new); if (!is_numeric($rs_pr)) {$rs_pr=0;} echo "<tr>"; if (($i+1)==10) { echo "<td>".($pagenum)."0"."</td>"; } else { echo "<td>".($pagenum-1).($i+1)."</td>"; } echo "<td align='left'><a target='_blank' href='".$url_new."'>".$url_new."</a></td>"; echo "<td>".$rs_pr."</td>"; if ($_POST['liens_yahoo']=='oui') { echo "<td>".get_nb_bl_yahoo($url_new)."</td>"; } echo "</tr>"; flush(); $i++; }//while }//while curl_close ($ch); echo '</tbody></table>'; }//POST GO ?>

Submit a new version

You can submit a new version of this snippet if you have modified it and you feel it is appropriate to share with others..

FEDER AQUINETIC Aquitaine Powered By FusionForge Collaborative Development Environment Charte d'utilisation / Nous contacter / Mentions légales Haut de page