Re: Can anyone help me save img from URL?
| From: | Robert Cummings | Date: | Thu, 16 May 2002 21:25:30 +0000 |
| Subject: | Re: Can anyone help me save img from URL? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-97978@lists.php.net to get a copy of this message | ||
Victor Polyushko wrote:
>
> Hi Guys,
>
> Thank you fo your input. I am sorry I am new to the list so + English is not
> my first language :-( anyhow., I shoudl 've made my question more clear.
>
> I am trying to save the image from the given URL
> (http://domain.com/image.gif) running a PHP script on the page. I have tried
> fread() and it does not allow me to accomplish that :-((
>
> Have you guys ever come across such a problem?
$imageData = implode( '', file( 'http://domain.com/image.gif' ) );
$length = strlen( $imageData );
if( $length > 0 )
{
if( (fh = fopen( 'destination', 'w' )) )
{
fwrite( fh, $imageData );
}
}
Cheers,
Rob.
--
.-----------------.
| Robert Cummings |
:-----------------`----------------------------.
| Webdeployer - Chief PHP and Java Programmer |
:----------------------------------------------:
| Mail : mailto:robert.cummings@webmotion.com |
| Phone : (613) 731-4046 x.109 |
:----------------------------------------------:
| Website : http://www.webmotion.com |
| Fax : (613) 260-9545 |
`----------------------------------------------'