- Basic functional interface for web programming (five functions)
- get($url) -- get the content of a URL
- head($url) -- get the headers of a URL; returns ($content_type,
$document_length, $modified_time, $expires, $server)
- getprint($url) -- print the content of a URL and return the status code
- getstore($url, $file) -- save the content of a URL in a file and return the status code
- mirror($url, $file) -- save the content of a URL in a file if it has changed and return the status code
- perldoc LWP::Simple for complete description
use LWP::Simple;
my $body = get("http://emergency.mit.edu/");
$body =~ m|<!-- begin content area -->(.*?)<!-- end content area -->|s;
$body = $1;
$body =~ s|<(.*?)>||g; # remove HTML tags (not very smart)
print $body;
Tuesday, January 27, 2009: There is no emergency on campus.The
Institute is open and operating as usual. PLEASE bookmark
this website as http://emergency.mit.net to provide the
Institute the greatest flexibility during an emergency.
The site http://emergency.mit.net expands our options to run
this website from locations other than MIT.
...
|