Ver Mensaje Individual
  #5 (permalink)  
Antiguo 26/04/2006, 14:59
Avatar de claudiovega
claudiovega
 
Fecha de Ingreso: octubre-2003
Ubicación: Puerto Montt
Mensajes: 3.667
Antigüedad: 20 años, 6 meses
Puntos: 11
Dice que en php5 se pueden leer urls.
Mas abajo hay ejemplos de como leer urls si no se tiene php5. Como este que tal vez sirva:

Código PHP:
<?php
   
function url_exists($url) {
       
$a_url parse_url($url);
       if (!isset(
$a_url['port'])) $a_url['port'] = 80;
       
$errno 0;
       
$errstr '';
       
$timeout 30;
       if(isset(
$a_url['host']) && $a_url['host']!=gethostbyname($a_url['host'])){
           
$fid fsockopen($a_url['host'], $a_url['port'], $errno$errstr$timeout);
           if (!
$fid) return false;
           
$page = isset($a_url['path'])  ?$a_url['path']:'';
           
$page .= isset($a_url['query'])?'?'.$a_url['query']:'';
           
fputs($fid'HEAD '.$page.' HTTP/1.0'."\r\n".'Host: '.$a_url['host']."\r\n\r\n");
           
$head fread($fid4096);
           
fclose($fid);
           return 
preg_match('#^HTTP/.*\s+[200|302]+\s#i'$head);
       } else {
           return 
false;
       }
   }
?>