Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl script to retrieve data from webpage

Status
Not open for further replies.

asanchez4

Programmer
Apr 22, 2004
32
0
0
US
i have written several perl scripts, but mainly simple ones that operate on local files.

I want to create a perl script to read a webpage, process the page, and create an output file.

Specifically, I want to write a script to open parse the file and retrieve the headlines, create an output file, e-mail the output file. (I find the funniest part of the website is just the headlines).

Can anyone please post some sample code on how to open an html file and process?

thanks in advance.
 
You'll required LWP

roughly like this:-

Code:
[b]#!/usr/bin/perl[/b]

use LWP::Simple;

print "Content-type: text/html\n\n";

$document = get("[URL unfurl="true"]http://www.fark.com");[/URL]

print $document;

I can give you a hand with the parsing/email bit if you have problems


Kind Regards
Duncan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top