1 #!/usr/bin/perl -w 2 use CGI qw(:standard); 3 use CGI::Carp qw(warningsToBrowser fatalsToBrowser); 4 use strict; 5 #### adding the bits from teat.pl 6 use warnings; 7 use LWP::Simple; 8 9 ###### setting up the variables for the form 10 my $query; 11 my $p; # chaged this for trouble shooting 12 #my $variable_name = param("srNumber"); 13 my $variable_name = 194951021; 14 15 16 17 ####### adding teat.pl 18 #here I take the number form the form and try to pull down page 19 # This fails with 500 error, but testing it through a browser it works, 20 # Hence the resion for the print statment 21 my $url = "http://test.test.com/pending/$variable_name"; 22 #print "\n This is the web site that I'm trying to got to : $url"; 23 my $file = 'testPseweb2.html'; 24 my $status = getstore($url, $file); 25 die "Error $status on $url" unless is_success($status); 26 27 28 29 30 31 ####### this part parses the file pulled down from lwp, and pick out what I want 32 my $img; 33 my $src; 34 my $alt; 35 my $a; 36 my $href; 37 my $href2; 38 my $msup; 39 my $msupdir; 40 my $substrMsup; 41 42 43 open(IN, "<$file") || die "Can't open $file: $!"; 44 while () { 45 my @array_of_data = ; 46 47 foreach my $line (@array_of_data) 48 { 49 50 chomp($line); 51 52 if ($line =~ /vm-support/i) 53 { 54 55 ################Now do something in this if statment 56 ############ Split The file, and pick out the correct word for time and date. 57 ##I'm picking out what I want out of the web page here 58 ($img, $src, $alt, $a, $href) = split (' ', $line); 59 ($href2, $msup, $msupdir) = split ('"', $href); 60 ($substrMsup) = split ('/', $msup); 61 } 62 } 63 } 64 close(IN); 65 66 print header; 67 print start_html("Thank You"); 68 print h2("Thank You"); 69 70 #print "variable name: $variable_name"; 71 #print "vm-support: $substrMsup"; 72 print end_html; 73 74 75 76