Ver Mensaje Individual
  #4 (permalink)  
Antiguo 24/02/2006, 10:15
Cluster
O_O
 
Fecha de Ingreso: enero-2002
Ubicación: Santiago - Chile
Mensajes: 34.417
Antigüedad: 22 años, 3 meses
Puntos: 129
Podrías usar en ese caso:

Código PHP:
<?php
   
// extraido de php.net
   // Por: Fabrizio (staff at bibivu dot com) 22-Dec-2005 04:11 

   
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;
       }
   }

// El url completo de tu archivo remoto:
$url="http://www.tal.tal/archivo.tal";

if (
$url){
   
// Si existe el archivo remoto .. te lo traes por captura del buffer. Podría ser también por fopen() .. fread() ..etc

   // inicias captura del buffer
   
ob_start():
   
// incluyes tu archivo ...
   
include("http://www.tal.tal/archivo.tal");
   
// te llevas a una variabel todo el buffer que tengas ...
   
$archivo=ob_get_contents();
  
// Te deshaces del buffer (ya lo tienes en tu variable) para usarlo cuando  quieras si lo necesitas presentar tal cual.
   
ob_end_clean();
} else {
   
// trabajas con tu archivo local ...
}
Un saludo,