CGI ABCNews Retriever
CGI
Download (.zip)
#!/usr/local/bin/perl ######################################################### # ABCNews Retriever # # # # abcnews.pl # # # # This script will fetch the World News from the # # ABCNews Website and display it on your Website. # # # # To install this script simply upload it to your # # CGI-BIN and CHMOD it 755. # # # # On any page where you want the ABCNews World News # # to be displayed put this SSI call: # # <!--#include virtual="cgi-bin/abcnews.pl"--> # # # #########################################################
print "Content-type: text/html\n\n"; use LWP::Simple; $doc = get "http://abcnews.go.com/";; @abc=split(/\n/,$doc); $rcd=0; $news=""; foreach $line (@abc){ $ft=substr "$line","",7; if($rcd==1){ if($line!~/font/){ if($ft ne '<!-- Wo'){ $news="$news\n<tr><td valign=top><font size=-1>•</font></td><td valign=top>$line</td></tr>"; } }else{ if($line!~/<\/font>/){ $news="$news\n$line"; } } } if ($ft eq '<B>W O '){ $rcd=1; }elsif($ft eq '</font>'){ $rcd=0; } } print "<table border=0 cellpadding=0 cellspacing=2>\n"; $news=~s/html\">/html\"><font size=-1>/gi; $news=~s/<\/a>/<\/a><\/font>/gi; print "$news</td></tr>"; print "<tr><td colspan=2></td></tr><tr><td colspan=2><p><center><font size=-2>Today's World News Provided by</font><br><a href=http://abcnews.go.com/><u><font color=blue size=-2>ABC</font><font color=black size=-2>NEWS.com</font></u></a><font size=-2> and the </font><a href=\"http://www.go2cgi.com/\"><u><font color=blue size=-2>ABC</font><font color=black size=-2>NEWS Retriever</font></u></a></center></p></td></tr>\n"; print "</table>\n";
|