DelphiFAQ Home Search:
General :: Programming :: perl
General questions about perl.

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.
Recommended links on this topic:
Featured Article

How can I download a file via http?

Question:

How can I download a file via http?

Answer:

You could make a system call to lynx and read the input. This puts a bit more load on your computer and should not be used if you are going to retrieve many documents.

You have more control and a more efficient solution using the LWP package (second part in the code below).

# invoking lynx

 $html_code = `lynx -source http://www.yahoo.com/`;
 $text_data = `lynx -dump http://www.yahoo.com/`;  
 
 # using LWP

 use LWP::Simple;
 $content = get('http://www.yahoo.com');
 

Generated 12:02:03 on Oct 20, 2017