Re: Remote grabbed images are blank

From: Date: Tue, 12 Oct 2004 21:57:07 +0000
Subject: Re: Remote grabbed images are blank
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-199307@lists.php.net to get a copy of this message
Hi Rick, Thanks for replying. > Mag wrote: > > Hi, > > I got a pretty good code snippet from Zend to grap > a > > remote image and save it to disk, the problem is, > when > > it saves to my disk i am unable to open the > > images...they are blank and the file matches the > > remote images filesize... > > [snip] > > > ob_start(); > > readfile($url); > > $img = ob_get_contents(); > > ob_end_clean(); > > $size = strlen($img); > > > > $fp2=@fopen($filename, "a"); > > fwrite($fp2,$img); > > fclose($fp2); > I'm not sure what the problem is, but simplifying > the code will help you > track it down. Rather than messing with output > buffering and > fopen/fwrite/fclose, I'd suggest using the copy() > function. > > This line replaces the 8 lines above: > > copy( $url, $filename ); > > --Rick One of the problems is that my host has a anti-leaching .htaccess file setup (which is good really) so people cant "hot-link"...problem is with copy() I am getting this error: HTTP/1.0 403 Forbidden Is there any way to forge the headers or something to get through? Thanks, Mag ===== ------ - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) __________________________________ Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. http://promotions.yahoo.com/new_mail

« previous php.general (#199307) next »