Ver Mensaje Individual
  #2 (permalink)  
Antiguo 06/03/2008, 05:39
Avatar de farra
farra
 
Fecha de Ingreso: marzo-2008
Ubicación: Aqui estoy
Mensajes: 574
Antigüedad: 16 años, 1 mes
Puntos: 20
De acuerdo Re: Spider simple

Código PHP:
<?php
$the_url 
= isset($_REQUEST['url']) ? htmlspecialchars($_REQUEST['url']) : '';
?>

<form method="post">
  Escribe la direccion URL completa de la pagina a extraer (incluyendo http://):<br />
  <input type="text" name="url" size="65" value="<?php echo $the_url;  ?>"/><br />
  <br />
  <br />
  <input type="submit" value="Parse Emails" />
</form>

<?php
if (isset($_REQUEST['url']) && !empty($_REQUEST['url'])) {
  
// fetch data from specified url
  
$text file_get_contents($_REQUEST['url']);
}
// parse emails
if (!empty($text)) {
  
$res preg_match_all(
    
"/[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}/i",
    
$text,
    
$matches
  
);

  if (
$res) {
    foreach(
array_unique($matches[0]) as $email) {
      echo 
$email "<br />";
    }
  }
  else {
    echo 
"No emails found.";
  }
}

?>