Bueno te dejo el código (son unas 60 lineas):
Código PHP:
Ver original//Aca arriba se encuentran algunas variables definidas junto con la funcion storelink
function extraer($url, $prof){
if(!$server_link){ die("Falló la Conexión ". mysql_error()); }
if(!$db_selected){ die("No se pudo seleccionar la Base de Datos ". mysql_error()); }
$url = "no";
$patron = "funciona";
$prof = 1;
$userAgent = 'buuuu';
//Aca viene lo peor:
if (!$html) {
}
//Si el código quisiera funcionar me haría muy feliz jajajaj
$dom = new DOMDocument();
@$dom->loadHTML($html);
$xpath = new DOMXPath($dom);
$hrefs = $xpath->evaluate("/html/body//a");
$busqueda = mysql_query("SELECT webUrl FROM webs WHERE webUrl='$url'"); preg_match_all ("(<meta name=\"description\" content=\"(.*)\"\/>)siU", $html, $description); preg_match_all ("(<meta name=\"keywords\" content=\"(.*)\"\/>)siU", $html, $keys); $titulo = $title[1][0];
$descripcion = $description[1][0];
$keywords = $keys[1][0];
storeLink($titulo,$descripcion,$url,$keywords);
}
for ($i = 0; $i < $hrefs->length; $i++) {
$href = $hrefs->item($i);
$url2 = $href->getAttribute('href');
extraer($url2, $prof ++);
}
}
extraer($url, $prof);
//FIN
Bueno, muchas gracias por todo, espero tu sentencia
PD: Volví a añadirle la @ al DOM, porque los errores que me muestra son del html de las páginas, para esto estoy viendo como utilizar tiny.