This is a very simple script which gets yahoo economic events from the yahoo finance website and converts it to XML.
#!c:\perl\bin\perl.exe
use LWP::Simple;
use LWP::UserAgent;
use HTML::TableExtract;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
my $cgi = new CGI;
my $url = “http://biz.yahoo.com/c/e.html”;
my $capture = get($url);
#http://www.treasurydirect.gov/xml/PendingAuctions.xml
print $cgi->header(-type => ‘application/xml’); # make browser expect xml
This script parses yahoo finance an pulls the Industry and sector for any ticker symbol you pass it. I used it to create a stock screener I am working on. Hope it becomes useful for you.
#!c:\perl\bin\perl.exe
use LWP::Simple;
use LWP::UserAgent;
use HTML::TableExtract;
if ($#ARGV != 0) {
print “$#ARGV usage: need to pass in a symbol\n”;
exit;
}
$sym = $ARGV[0];
my $url = “http://finance.yahoo.com/q/in?s=$sym”;
my $capture = get($url);