RES: [PHP-GENERAL] fread() and fwrite()

From: Date: Thu, 15 Jun 2000 12:49:45 +0000
Subject: RES: [PHP-GENERAL] fread() and fwrite()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-1927@lists.php.net to get a copy of this message
Michael, If the problem is on the server, how can I know that? But I think thats not the problem cause I can use fopen through text files in URLs. I guess the problem is reading an image, but the manual says fread and fwrite are binary-safe operations. Carlos -----Mensagem original----- De: Michael Stearne [mailto:mstearne@entermix.com] Enviada em: quarta-feira, 14 de junho de 2000 21:37 Para: Carlos Henrique Cc: php-general Assunto: Re: [PHP-GENERAL] fread() and fwrite() It is possible that your server has the opening of URLs through fopen disabled. Do you know if this is the case? Carlos Henrique wrote: > Hi folks!!! > > That's my task: read an image file from a url and then write it on my > server. My code is listed below and doesnt work. I've tried with mode 'b' > (for binary) in fread and fwrite but still doesnt working. The problems is > not file permissions cause the out directory is writable. I noticied the > fread function always returns zero. Anyone have tried this before? Any tip > or trick to help me? Thanx id advance! > > $in = "http://www.host.com/image.gif"; > $out = "images/image.gif"; > > $f_read = fopen($in,"r"); > $img = fread($f_read,filesize($in)); > fclose($f_read); > > $f_write = fopen($out,"w"); > fwrite($f_write,$img); > fclose($f_write); > > Best Regards, > Carlos > > PS: Before someone ask, no, this script doesnt steal images from sites, its > for our partners who share with us piece of html codes and his images! :) > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#1927) next »