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

P

Paul Lalli

ARGENTINA said:
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
 
J

jbl

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top