Hallo, Chris!

Oh, in this library "getstore" is more matching I suppose.
Thank you!

Chris Devers wrote:

On Fri, 8 Oct 2004, Nicolay A. Vasiliev wrote:

I need to be adviced how to implement the subject. I have URL of an image and I need to copy this to another web-server. I tried to make it with ImageMagick, but I got an error opening the file by URL.

Which way could more correct to produce such operation?


The standard library for writing web clients -- which, in this context, your web server is acting as -- is LWP. The LWP::Simple module may be the easiest way to do this:

       use LWP::Simple;
       $image = get("http://www.sample.url/images/sample.jpg";);
       die "Couldn't get it!" unless defined $image;

At that point, just write the contents of $image to a file.

See the LWP::Simple perldoc for more info, or the LWP docs:

     <http://search.cpan.org/dist/libwww-perl/lib/LWP/Simple.pm>

Or see the e-book _Web Client Programming with Perl_ by Clinton Wong:

     <http://www.oreilly.com/openbook/webclient/>

It's a bit old, but still covers the basics.



http://www.soft411.com - Excellent soft archive http://www.spamliquidator.com - Kill spam


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to