Ver Mensaje Individual
  #5 (permalink)  
Antiguo 23/01/2009, 15:13
Avatar de JoniJnm
JoniJnm
 
Fecha de Ingreso: mayo-2007
Ubicación: Madrid
Mensajes: 264
Antigüedad: 19 años, 5 meses
Puntos: 4
Respuesta: Obtener location.href de un iframe de otro servidor

Gracias, haciendo una prueba me da error:

Código PHP:
die(file_get_contents("http://www.forosdelweb.com")); 
Cita:
Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in xxx.php on line 50

Warning: file_get_contents(http://www.forosdelweb.com) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in xxx.php on line 50
Pero al final he usado esto:

Código PHP:
$server = $_GET['server'];
$file = "/".$_GET['file'];

$ip = gethostbyname($server);
$fp = fsockopen($ip, 80);
if (
$fp) {
    
$crlf = "\r\n";
    
$com = 'GET '.$file.' HTTP/1.0'.$crlf.'Host: '.$server.$crlf.$crlf;
    
fputs($fp, $com);
    while (!
feof($fp)) {
        
$cont .= fgets($fp, 1024);
    }
    
fclose($fp);
    
$cont = substr($cont, strpos($cont, "\r\n\r\n") + 4);
}

echo 
$cont; 
__________________
JoniJnm.es