Saving an image from external site

Discussion in 'Perl Misc' started by asdfq213rr23we@yahoo.com, Jan 30, 2005.

  1. Guest

    Hi

    In Perl, how can I grab an image through its URL and save it on my
    server?

    Ex: save www.site.com/image.jpg onto a dir on my server (another.com)

    Im looking at setting a cronjob that through this perl script grabs
    this specific image once an hour and puts it on my server

    Thanks
    , Jan 30, 2005
    #1
    1. Advertising

  2. wrote:

    > Hi
    >
    > In Perl, how can I grab an image through its URL and save it on my
    > server?
    >
    > Ex: save www.site.com/image.jpg onto a dir on my server (another.com)
    >
    > Im looking at setting a cronjob that through this perl script grabs
    > this specific image once an hour and puts it on my server
    >
    > Thanks


    You want LWP::Simple. In fact, you may want to dispense with Perl
    altogether and use wget, but LWP::Simple is the way to go if you
    want to use Perl.

    --
    Christopher Mattern

    "Which one you figure tracked us?"
    "The ugly one, sir."
    "...Could you be more specific?"
    Chris Mattern, Jan 30, 2005
    #2
    1. Advertising

  3. Chris Mattern wrote:

    > wrote:
    >
    >> Hi
    >>
    >> In Perl, how can I grab an image through its URL and save it on my
    >> server?
    >>
    >> Ex: save www.site.com/image.jpg onto a dir on my server (another.com)
    >>
    >> Im looking at setting a cronjob that through this perl script grabs
    >> this specific image once an hour and puts it on my server
    >>
    >> Thanks

    >
    > You want LWP::Simple. In fact, you may want to dispense with Perl
    > altogether and use wget, but LWP::Simple is the way to go if you
    > want to use Perl.
    >


    I use cron & wget:
    13,28,43,58 * * * * wget http://XXX.com -O /home/aaa/XXX >/dev/null 2>&1

    gtoomey
    Gregory Toomey, Jan 30, 2005
    #3
  4. <> wrote:

    > In Perl, how can I grab an image through its URL



    The same way you grab HTML through its URL.

    perldoc -q HTML

    How do I fetch an HTML file?


    > and save it on my
    > server?



    That depends on what kind of access you have to this "server".


    > Im looking at setting a cronjob



    On this "server" or somewhere else?


    > that through this perl script grabs
    > this specific image
    > once an hour and puts it on my server



    use LWP::Simple for downloading the image.

    We can't help with how to put it on your server if we don'
    know what access you have available to you.


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Jan 30, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Kandell
    Replies:
    4
    Views:
    4,136
    eeebop
    Dec 10, 2004
  2. Luis Esteban Valencia
    Replies:
    0
    Views:
    2,486
    Luis Esteban Valencia
    Jan 6, 2005
  3. Milsnips
    Replies:
    0
    Views:
    387
    Milsnips
    Nov 16, 2005
  4. Nathan Sokalski

    Saving an image to SQL Server's image datatype

    Nathan Sokalski, Jul 17, 2008, in forum: ASP .Net
    Replies:
    9
    Views:
    29,396
    steve
    Aug 3, 2008
  5. Lovely Angel For You

    Saving Images While Saving ASP Pages !

    Lovely Angel For You, Oct 2, 2003, in forum: ASP General
    Replies:
    1
    Views:
    188
    Curt_C [MVP]
    Oct 3, 2003
Loading...

Share This Page