Ver Mensaje Individual
  #9 (permalink)  
Antiguo 10/05/2010, 15:11
Axelite
 
Fecha de Ingreso: febrero-2009
Mensajes: 12
Antigüedad: 15 años, 2 meses
Puntos: 0
Respuesta: Buscar links en web y entrar aleatoriamente.

Experimentando con codigos ajenos logre lo que queria!
O al menos eso parece jejeje...

Aqui esta el codigo por si alguien lo necesita.

Código PHP:
Ver original
  1. <?php
  2. $url = "http://www.google.com";
  3.     $var = fread_url($url);
  4.            
  5.     preg_match_all ("/a[\s]+[^>]*?href[\s]?=[\s\"\']+".
  6.                     "(.*?)[\"\']+.*?>"."([^<]+|.*?)?<\/a>/",
  7.                     $var, &$matches);
  8.        
  9.     $matches = $matches[1];
  10.     $list = array();
  11.  
  12.  
  13.  
  14.  
  15.  
  16. // The fread_url function allows you to get a complete
  17. // page. If CURL is not installed replace the contents with
  18. // a fopen / fget loop
  19.  
  20.     function fread_url($url,$ref="")
  21.     {
  22.         if(function_exists("curl_init")){
  23.             $ch = curl_init();
  24.             $user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; ".
  25.                           "Windows NT 5.0)";
  26.             $ch = curl_init();
  27.             curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
  28.             curl_setopt( $ch, CURLOPT_HTTPGET, 1 );
  29.             curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
  30.             curl_setopt( $ch, CURLOPT_FOLLOWLOCATION , 1 );
  31.             curl_setopt( $ch, CURLOPT_FOLLOWLOCATION , 1 );
  32.             curl_setopt( $ch, CURLOPT_URL, $url );
  33.             curl_setopt( $ch, CURLOPT_REFERER, $ref );
  34.             curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
  35.             $html = curl_exec($ch);
  36.             curl_close($ch);
  37.         }
  38.         else{
  39.             $hfile = fopen($url,"r");
  40.             if($hfile){
  41.                 while(!feof($hfile)){
  42.                     $html.=fgets($hfile,1024);
  43.                 }
  44.             }
  45.         }
  46.         return $html;
  47.     }
  48. $numero = rand(1,7);
  49.  print($matches[$numero]."<br>");
  50. ?>