Re: Can anyone help me save img from URL?
| From: | Victor Polyushko | Date: | Fri, 17 May 2002 00:04:20 +0000 |
| Subject: | Re: Can anyone help me save img from URL? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-97988@lists.php.net to get a copy of this message | ||
BINGO!! thank you guys for your input
I used a very simple command to accomplish that and it works!!
<?
$command="wget http://domain.com/images/somepic.gif";
system( $command, $result);
echo $result; ?>
Victor Polyushko
----- Original Message -----
From: "Robert Cummings" <robert.cummings@webmotion.com>
To: "Victor Polyushko" <victor@gbiswebdesign.com>
Cc: <php-general@lists.php.net>
Sent: Thursday, May 16, 2002 2:25 PM
Subject: Re: [PHP] Can anyone help me save img from URL?
> 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( '!…>?OÏíûÃ㌜ã
> š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 |
> `----------------------------------------------'
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>