Ver Mensaje Individual
  #5 (permalink)  
Antiguo 10/05/2010, 13:03
Avatar de spider_boy
spider_boy
 
Fecha de Ingreso: diciembre-2003
Ubicación: Chile
Mensajes: 1.855
Antigüedad: 20 años, 4 meses
Puntos: 89
Respuesta: Buscar links en web y entrar aleatoriamente.

¿Pero esperabas que te hiciéramos la tarea?

¿Probaste algo como esto?

Código PHP:
Ver original
  1. $dom = new DOMDocument();
  2. @$dom->loadHTML($html);
  3.  
  4. // grab all the on the page
  5. $xpath = new DOMXPath($dom);
  6. $hrefs = $xpath->evaluate("/html/body//a");
  7.  
  8. $urls = array();
  9.  
  10. for ($i = 0; $i < $hrefs->length; $i++) {
  11.        $href = $hrefs->item($i);
  12.  
  13.        $urls[] = $href->getAttribute('href');
  14. }
  15. print_r($urls);

No sé como funciona aquella librería. No sé si el método getAttribute devuelve todos los 'href', o el primero que encuentre. Si lo meto dentro de un ciclo for, ¿realmente estaré recorriendo todos los href?...
__________________
Nunca te olvidaré mi negra hermosa. Te extraño demasiado.