Spider web con Curl

Iniciado por Oggy, Diciembre 03, 2012, 05:28:55 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Aqui dejo un Spider de url's el cual Recorre una página Gracias a la libreria curl, luego Con unos parametros establecidos con preg_match_all Busca todos los datos parametrizados en esa función y retorna Lo que encontro.



Código: php
<form action="craw.php" method="post"/>
<input type="text" name="link" value="http://"/><br>
<input type="submit" value="enviar"/>
</form>
<?php
$url = @$_POST["link"];

if(isset($url))
{
$ch = curl_init("$url");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1 );
$abrir = curl_exec($ch);
curl_close($ch);
preg_match_all("/<a(?:[^>]*)href=\"([^\"]*)\"(?:[^>]*)>(?:[^<]*)<\/a>/is", $abrir, $matches);
header("Content-type: text/plain");
var_dump($matches);
}
?>

Esto se me ocurrio Despues de haber Hecho el Identificador de servidores web.

genial buen aporte y buen code.

saludos!