Jump to content


Photo

Script De Busca


  • Faça o login para participar
Nenhuma resposta neste tópico

#1 ZeCa^CsPlanet

ZeCa^CsPlanet

    Novato no fórum

  • Usuários
  • 18 posts
  • Sexo:Não informado

Posted 14/12/2003, 16:24

Olá, eu peguei esse script de busca de autoria de Renan Gonçalves, muito bom, que não utiliza banco de dados e exibi resultados encontrados em outros sites de busca.

Gostaria que vocês fizessem as seguintes modificações nesse código:
Só sites em português
Exibição de mais resultados (10 por página)

Desde já agradeço.

Aqui segue o código:
<html>
<head>
	<title>Sistema de Busca</title>
<style>
body {background-color: #FFFFFF;
margin-left:0px;
margin-right: 0px;
margin-top: 0px;
margin-bottom: 0px;
color: "#000000";
font-size:8pt; 
font-family: "arial";
}

a:link {text-decoration: none; color: #000000;}
a:visited {text-decoration: none; color: #000000;}
a:hover {text-decoration: underline; color: #000000;}

.font08 {font-size:8pt; font-family: "arial";}
.font10 {font-size:10pt; font-family: "Arial";}
.font12 {font-size:12pt; font-family: "Arial";}

.preto {font-size:8pt; font-family: "arial"; color: #000000; font-weight: "bold";}

h1 {font-size:14pt; font-family: "arial";}

input.user {
	background: #ffffff;
	border-color: Black;
	border: 1px;
	border-style: solid;
	font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
	font-size: xx-small;
}
</style>
</head>

<body>
<br>
<h1 align="center">Pesquisar na Web</h1>
<p align="center"><FORM method=get>
 Procura por: <input type=text name=search class="user">&nbsp;&nbsp;<input type=submit name=Search value=Pesquisar class="user"><br>
</FORM></p>
<hr>
<?
#- Start search 
if($search) {
 
 $q = urlencode($search);
 
 $start = time();

 $eng[0]['url'] = "http://www.alltheweb.com/search?cat=web&lang=any&query=$q";
 $eng[0]['name'] = "AllTheWeb";
 $eng[0]['reg'] = '/<dt>.*?href=\"(.*?)\">(.*?)<\/a>.*?<dd>(.*?)<br>/i';
 $eng[0]['strip'] = "\n";

 $eng[1]['url'] = "http://altavista.com/sites/search/web?q=$q&enc=&kl=XX&search=Search";
 $eng[1]['name'] = "Altavista";
 $eng[1]['reg'] = "/<A .*?status='(.*?)'.*?\">(.*?)<\/A>.*?<BR>(.*?)<BR>/i";
 $eng[1]['strip'] = "\n";

 $eng[2]['url'] = "http://search.msn.com/results.asp?ba=(0.0)0&co=(0.10)4.1..2.1.4.1&FORM=MSNH&RS=CHECKED&q=$q&v=1";
 $eng[2]['name'] = "MSN";
 $eng[2]['reg'] = "/<A CLASS.*?href=\"(.*?)\">(.*?)<\/A><br.*?>(.*?)<br/i";
 $eng[2]['strip'] = "";

 $eng[3]['url'] = "http://search.excite.com/search.gw?c=web&search=$q&onload=";
 $eng[3]['name'] = "Excite";
 $eng[3]['reg'] = "/pos=.*?;(http.*?)onMouse.*?<b>(.*?)<br>.*?size8>(.*?)<\/span>/i";
 $eng[3]['strip'] = "\n";

 $eng[4]['url'] = "http://google.yahoo.com/bin/query?p=$q&hc=1&hs=4";
 $eng[4]['name'] = "Yahoo";
 $eng[4]['reg'] = "/href.*?\*(.*?)\">(.*?)<br>.*?<\/b>(.*?)<br>/i";
 $eng[4]['strip'] = "\n"; 

 $urls = array();
 $out = array();
 $y=0;

foreach($eng as $c)
   {
     $text1 = join("",file($c['url']));

     if($c[strip])
       $text1 = ereg_replace($c[strip],"",$text1);
       
     preg_match_all($c['reg'],$text1,$matches);
     $num = count($matches[0]);
     
     for($x=0;$x<$num;$x++) {
     $url = strip_tags($matches[1][$x]);
     $title = strip_tags($matches[2][$x]);
     $description = strip_tags($matches[3][$x]);
     $engine = $c[name];
     
     if($out["$url"])
       {
         $out["$url"][engine] .= ", '".$engine."'";
       }
     else
       {
         $out["$url"][title] = $title;
         $out["$url"][description] = $description;
         $out["$url"][engine] = $engine;
       }  
      $y++;
     } 
       
   }#rof

 $secs = time() - $start;
 
 echo "<p class=font12 align=center>A pesquisa encontrou $y resultados em $secs segundos.</p><br><br>";
 echo "<OL>";

 while(list($url,$rec) = each($out))
   {
     extract($rec);
     echo " 
	<li>
	<p align=justify><a href=$url target=_blank><b>$title</b></a><BR>
    $description
	<FONT size=1><BR>$url<br></FONT></p>"; 
   }

 echo "</OL>";  

 echo "
	</BODY>
	</HTML>
	";	
 } #end search
?>

</body>
</html>





1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq