Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Oct 2007
    Thanked 0 Times in 0 Posts

    Display contents from html file to a webpage.How?

    I'm trying to build a perl script for the following:

    1. I've a perl script from which an email is sent to specific people about the results. I've used MIME::Lite for the email. I've now used this MIME::Lite module to store the email into a html file such as xyz.html at a location on the system.
    2. Now, i need to display the already created .html file on a webpage which is almost like the below example:
    3. I've googled for a solution for this the entire week but didn't find any concrete solution. Thereby, please provide me some pointers or any help on how to go about this would be of great help.

    Below is a script which doesn't work as per the above requirements.
    $ua = new LWP::UserAgent;
    $req = new HTTP::Request GET => 'http://www.xyz.com/pages/editpage.action?pageId=197432134';
    $req->authorization_basic('sqabuilder', 'Pallas582_556_500');
    $output = $ua->request($req)->as_string;
    #$output =~ s!^HTTP/\d+\.\d+!Status:!;
    $output =~ /^Android\sAutomation\srun\son/;
    print "Edited page is:". $output . "\n";
    $uname = 'sqabuilder';
    $paswd = 'Pallas582_556_500';
    		use LWP::UserAgent;
            $ua = LWP::UserAgent->new;
    		use Term::ReadKey;
    		$pf = 'Android Automation run';
    		open (out,"<$f1");
    			 $req = HTTP::Request->new(GET =>"$lne");
    			 print outfile "updated on 30th August\n";
    			 print outfile $ua->request($req)->as_string;
    			 close outfile;
    			 print "Please wait updating the changes\n";
    	sub web_login
    	     print "Weblink is: $weblink \n"; 
    		 $req = HTTP::Request->new(GET =>"$weblink");
    		 $req->authorization_basic("$uname", "$paswd");
    		 #$req->credentials( $uname, $paswd );
    		 print "Please wait: attempting to login\n";
    		 print out $ua->request($req)->as_string;
    		 close out;
    Thanks a lot in advance.


  2. #2
    Super Moderator
    Join Date
    May 2005
    Southern tip of Silicon Valley
    Thanked 233 Times in 226 Posts
    Your problem description is not very clear.
    Now, i need to display the already created .html file on a webpage
    What does that mean? Do you need to redirect the user to your xyz.html page or do you need to fill out a web form with the data in your xyz.html file?

    Below is a script which doesn't work as per the above requirements.
    The only "requirement" you mentioned was display your html file "on a webpage".

    In what way does your script not produce your desired results?

    The first recommendation I will make is for you to add these 2 statements near the top of the script and fix the problems that they point out.
    use strict;
    use warnings;
    You also need to fix your code indentation.

    If you need to automate webpage navigation, then it might be easier/better to use a higher level module which handles the gory details.

    WWW::Mechanize is what is normally used for this purpose. Unfortunately, I have not yet used it myself so I can't give too much help in that area.

    Can you post a short but complete script that demonstrates your problem?


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts