For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > December 2004 > Using perl how do you write a script to copy a remote file into your own site









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

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

2004-12-29, 3:57 pm

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
Paul Lalli

2004-12-29, 3:57 pm

"ARGENTINA" <sjprec@yahoo.com> wrote in message
news:f2747eca.0412290510.f238d00@posting.google.com...
> 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

jbl

2004-12-30, 3:58 pm

On 29 Dec 2004 05:10:08 -0800, sjprec@yahoo.com (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


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com