Ver Mensaje Individual
  #9 (permalink)  
Antiguo 27/11/2007, 15:29
Avatar de IMAC/
IMAC/
 
Fecha de Ingreso: octubre-2005
Mensajes: 738
Antigüedad: 20 años, 11 meses
Puntos: 14
Re: Leer imagen de URL externa php

Muchas gracias por la rápida respuesta y por molestarte.
Pero... aún no me sale :S no se por qué.
Lo único que sale por pantalla es la ruta de la url en la que estoy.

Imaginemos que la imagen que quiero cargar esta aquí:
http://www.webexterna.es/imgs/1.jpg

Como lo haría, ¿así? :
Código PHP:
$image= "imgs/1.jpg";    

$fs = fsockopen( "www.webexterna.es", 80, $errno, $errstr, 30 );
$command = "GET /$image HTTP/1.1\r\n";
$command .= "Host: www.webexterna.es\r\n";
$command .= "Connection: Close\r\n\r\n";

fwrite( $fs, $command );

header("Content-Type: image/jpeg");
while( 
$data = fread( $fs, 1024 ) ) {
      echo 
$data;
}
fclose( $fs ); 
Una pregunta, ¿para qué el while si solo quiero cargar una imagen?

Gracias.