Re: Best way to recieve image from url?

From: Date: Mon, 20 Oct 2008 08:46:45 +0000
Subject: Re: Best way to recieve image from url?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-282125@lists.php.net to get a copy of this message
> ... You could read it progressively using fopen(), fread() et al. Probably. This would mean only a small amount of data is read by yours erver at once. Eg: $rp = fopen('http:www.example.com/title.png', 'r'); $wp = fopen('mylocalfile', 'w'); while ($block = fread($rp, 8192)) { // 8k block size fwrite($wp, $block); } fclose($rp); fclose($wp); From memory. Something like that. Fopen() modes may need tweaking. -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.rgraph.org

« previous php.general (#282125) next »