utilisé google en éliminant, pub et tout ce qui est inutile.
Posté : 09 mai 2010, 22:21
bonjour,
je vous donne ce petit script si vous souhaité ajouté ggogle comme moteur de recherche sur votre site et que vous ne voulez pas la pub et tout ce qui est inutile à la recherche.
il peut encore être optimisé. Je n'est pas commenté le script mais il fonctionne très bien.
je vous donne ce petit script si vous souhaité ajouté ggogle comme moteur de recherche sur votre site et que vous ne voulez pas la pub et tout ce qui est inutile à la recherche.
il peut encore être optimisé. Je n'est pas commenté le script mais il fonctionne très bien.
<style>
h3{margin:0;padding:0;}
</style>
<?php
$page=intval($_GET['page']);
$page1=$page-10;
$nbchara=ereg_replace("[^a-z0-9]",'',$mot_cle);
$nbchara=strlen($nbchara);
if($nbchara < 3) { ?>Vous avez entré moins de 3 charactère.<br>Éffectuez une nouvelle recherche.<br><? exit();}
$description=file_get_contents('http://www.google.fr/search?q='.$mot_cle.'&sitesearch=http%3A%2F%2Fwww.larosedelorient.com&start='.$page.'').'pouzjutretcrte';
$description=str_replace(array('En cache','Pages similaires',' - '),'',$description);
$description=str_replace(array('"','<div>','</div>'),' ',$description);
$description1=ereg_replace("^<!doctype html><head>.*<ol>","<ol>",$description);
$description1=ereg_replace("</ol>.*pouzjutretcrte","</ol>",$description1);
$description1=str_replace('<li','</li><br><br><li',$description1);
$description1=str_replace(array('<ol></li><br><br>','<em>','</em>','= ','<span class=gl>','<cite>','</cite>','</span>',' class=l'),array('<ol>','<b>','</b>','=',''),$description1);
$description1=str_replace('href=http://www.larosedelorient.com/','href=',$description1);
if(ereg("<ol>",$description1)){
echo $description1;}else{ ?>Pas de résultat a votre recherche.<br>Éffectuez une nouvelle recherche.<br> <?php }
if($page==0){$nbpage=ereg_replace("^<!doctype html><head>.*<td class=b><img ","",$description);}
else{$nbpage=ereg_replace("^<!doctype html><head>.*Précédent","<a href=moteur1.php?recherche=$mot_cle&page=$page1>Précédent</a>",$description);}
$nbpage=ereg_replace("</table>.*pouzjutretcrte","",$nbpage);
$nbpage=str_replace(array('search','</a>','<br>','src= nav_first.gif width=18 height=26 alt= border=0><td class=cur><img src= nav_current.gif width=16 height=26 alt= border=0>','<img src= nav_page.gif width=16 height=26 alt= border=0>','<img src= nav_next.gif width=100 height=26 alt= border=0><span style= display:block;margin-left:53px >','</span>','<td>','<td class=b>','<td class=cur>','<img src= nav_current.gif width=16 height=26 alt= border=0>','<img src= nav_last.gif width=46 height=26 alt= border=0>'),array('search.php','</a> ',''),$nbpage);
if(!ereg("<head>",$nbpage)){echo '<div align=center>'.$nbpage.'</div>';}
?>