Re: fread() and fwrite()
| From: | Michael Stearne | Date: | Thu, 15 Jun 2000 00:36:51 +0000 |
| Subject: | Re: fread() and fwrite() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-1893@lists.php.net to get a copy of this message | ||
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