Using perl how do you write a script to copy a remote file into your own site

Discussion in 'Perl Misc' started by ARGENTINA, Dec 29, 2004.

  1. ARGENTINA

    ARGENTINA Guest

    Using perl how do you write a script to copy a remote file into your
    own site. In my situation want to copy a rss feed from
    http://remoteserver/news.xml for example.

    Marcos
    ARGENTINA, Dec 29, 2004
    #1
    1. Advertising

  2. ARGENTINA

    Paul Lalli Guest

    "ARGENTINA" <> wrote in message
    news:...
    > Using perl how do you write a script to copy a remote file into your
    > own site. In my situation want to copy a rss feed from
    > http://remoteserver/news.xml for example.


    http://search.cpan.org is usually a good place to start.

    For just saving a file off the web, I would recommend using LWP::Simple.
    For working with RSS feeds, go to the above site and search for RSS, and
    use whichever module looks best suited to your task.

    Paul Lalli
    Paul Lalli, Dec 29, 2004
    #2
    1. Advertising

  3. Re: Using perl how do you write a script to copy a remote file intoyour own site

    ARGENTINA wrote:

    > how do you write a script to copy a remote file into your
    > own site.


    How do I write it? With a text editor, of course. :)

    > In my situation want to copy a rss feed from
    > http://remoteserver/news.xml for example.


    What have you tried so far?

    If you need to learn Perl, have a look at:
    <http://learn.perl.org>

    If you need to find out about Perl modules:
    <http://www.cpan.org>

    sherm--

    --
    Cocoa programming in Perl: http://camelbones.sourceforge.net
    Hire me! My resume: http://www.dot-app.org
    Sherm Pendley, Dec 29, 2004
    #3
  4. ARGENTINA

    jbl Guest

    On 29 Dec 2004 05:10:08 -0800, (ARGENTINA) wrote:

    >Using perl how do you write a script to copy a remote file into your
    >own site. In my situation want to copy a rss feed from
    >http://remoteserver/news.xml for example.
    >
    >Marcos



    use LWP::Simple;

    # The following functions are provided (and exported) by this module:

    get($url)
    # The get() function will fetch the document identified by the given
    # URL and return it. It returns undef if it fails. The $url argument
    # can be either a simple string or a reference to a URI object.

    head($url)
    # Get document headers. Returns the following 5 values if successful:
    # ($content_type, $document_length, $modified_time, $expires, $server)

    getprint($url)
    # Get and print a document identified by a URL. The document is
    # printed to the selected default filehandle for output (normally
    # STDOUT) as data is received from the network. If the request fails,
    # then the status code and message are printed on STDERR. The return
    # value is the HTTP response code.

    getstore($url, $file)
    # Gets a document identified by a URL and stores it in the file. The
    # return value is the HTTP response code.



    jbl
    jbl, Dec 30, 2004
    #4
  5. ARGENTINA

    Joe Smith Guest

    Re: Using perl how do you write a script to copy a remote file intoyour own site

    ARGENTINA wrote:
    > script to copy a remote file into your own site.


    You don't even need a script; this can be done from the command line
    or from a cron job.

    perl -MLWP::Simple -e 'getstore "http://www.cpan.org/","example.html"'

    -Joe
    Joe Smith, Dec 30, 2004
    #5
    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. Jeffrey Barish

    Problem using copy.copy with my own class

    Jeffrey Barish, Apr 22, 2008, in forum: Python
    Replies:
    7
    Views:
    355
    Jeffrey Barish
    Apr 24, 2008
  2. Immortal Nephi
    Replies:
    3
    Views:
    368
    James Kanze
    Sep 15, 2010
  3. Mark Shapiro
    Replies:
    3
    Views:
    546
    Mark Shapiro
    Oct 8, 2011
  4. c676228
    Replies:
    3
    Views:
    163
    c676228
    Sep 14, 2006
  5. David Filmer
    Replies:
    17
    Views:
    253
    J. Romano
    Aug 18, 2004
Loading...

Share This Page