#!/usr/bin/perl
use warnings;
use LWP::UserAgent;
use HTTP::Cookies;
use XML::Simple; #qw(:strict);
use Data::Dumper;
# module to make web requests
use LWP::Simple;
use CGI;
# this is going to help us by outputting errors to the browser
# so that we can debug
use CGI::Carp qw(fatalsToBrowser);
my $params = new CGI;
my $ua= LWP::UserAgent->new;
$ua->agent("601 crawler/1.0");
# this is the web page url from which you want to extract info
$req= HTTP::Request->new(GET => "http://mobile.theride.org/rideguide_m.asp?route=4#key");
$res = $ua->request($req);
$page = $res->content;
&print_top;
&print_form;
&print_bottom;
exit(1);
#-----------------------------------------------
sub print_top {
print "Content-type: text/html\n\n";
print "<html>";
print "<head>";
print "<title>AATA - Route 4</title>";
print "<script language=\"javascript\" type=\"text/javascript\">setTimeout(\"location.reload();\",30000);</script>";
print '<meta name = "viewport" content = "width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" /> <!-- For mobile browsers -->';
print "</head>";
&printstylesheet;
print "<body>";
}
sub print_form {
print "</br></p>";
print "
<FORM>
<input class=\"txtbtn\" type=\"button\" value=\"Reload Page\" onClick=\"window.location.reload()\">
</FORM>
";
@lines = (split/<\/form>|<FONT SIZE=1 FACE="Arial">|<!--|<FORM/, $page);
foreach $line(@lines) {
if($line=~m/Information Key/) {
print "<h2>$line</h2>";
}
}
print "
<FORM>
<input class=\"txtbtn\" type=\"button\" value=\"Reload Page\" onClick=\"window.location.reload()\">
</FORM>
";
}
# close the HTML tags
sub print_bottom {
print "<div id='footer'><p>cheers: yuliang</p></div>\n";
print "</body></html>\n";
}
sub printstylesheet {
print "<style media='screen' type='text/css'>
/* CSS Document */
body {
background:#9343B9;
text-align:center;
margin:0px;
padding:0px;
color:#FFF;
font-family: Helvetica, Arial, Tahoma, Geneva, sans-serif;
font-size: 80%;
background: #333;
}
a {
color:#FFF;
text-decoration:none;
border-bottom:1px dotted;
}
a:hover {
border-bottom:1px solid;
color:#9343B9;
}
h2 {
text-align:center;
}
#footer {
position:relative;
top:1px;
background:#7A2875;
width:100%;
clear:both;
margin:0;
padding:1% 0;
text-align:center;
}
.txtbtn {
font-size:24px;
font-family:Helvetica, Arial, Tahoma, Geneva, sans-serif;
}
</style>
"
}
Post new comment