Re: Remote grabbed images are blank

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux