#!/usr/bin/perl use CGI qw(:all); use LWP::UserAgent; ########## Installation Instructions ############## # # Install the program in a directory where You are # allowed to execute cgi scripts. # Set permissions to executable. # Call the script with SSI. # ############# Configuration Area ################## # # Seconds to wait for reply from Coti Website. $timeout = 5; # # What feed to use # 6 = Lone star chatter # 12 = T20 Transmissions # 14 = T5 Transmissions # 16 = TNE Transmissions # 18 = COTI - Today's Active Topics # 20 = FLEET DISPATCHES $xmlno = 20; # # RGB colors used in table $tabcol[0] = "#FFFFFF"; $tabcol[1] = "#EEEEEE"; # ################################################### # You really don't have to modify anything below this line print header; # Calculate URL depending on input $url = "http://www.TravellerRPG.com/CotI/Discuss/ContentIslands/$xmlno/rss092.xml"; # Get url $feed = &get_url($url,$timeout); if ($feed eq "") { print "Coti Boards not currently available..."; goto THEEND; } @lines = split(/\n/, $feed); $item = 0; foreach $line (@lines) { # item if ($line =~ m,,) { $item++; } # title if ($line =~ m,(.*),) { $title[$item] = $1; } # link if ($line =~ m,(.*),) { $link[$item] = $1; } } # end foreach print ""; for ($post = 0; $post <= $item; $post++) { $tcol = $post%2; print "\n\n"; } print "
$title[$post]
"; THEEND: exit; # End of Program # Subroutines sub get_url { my ($url,$timeout_length) = @_; my $page_returned = ""; $ua = new LWP::UserAgent; $ua->timeout($timeout_length); my $req = new HTTP::Request GET => "$url"; my $res = $ua->request($req); if ($res->is_success) { $page_returned = $res->content; } return $page_returned; }