Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
Need a perl program


Feb 8, 2000, 11:28 AM

Views: 4986
Need a perl program

I need a perl program (a simple one I think) that takes a txt file from the www, on a specific location (which is updated continuesly) and outputs it to an HTML file on the same server as the perl program.


Feb 11, 2000, 10:51 PM

Views: 4986
Re: Need a perl program

You can try LWP

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

#!/usr/bin/perl -w
# Perl script to download a Web page.
use LWP::UserAgent;

# The agent helps you get web documents.
$webagent = new LWP::UserAgent;

print "Content-type: text/html\n\n";

$url = 'http://www.whatever.com/file_to_display.txt';

$request = new HTTP::Request(GET => $url);

# Get web document.
$response = $webagent->request( $request );

if ( $response->is_success ) {
print "header information\n";
print $response->content, "\n";
print "footer information\n";

[This message has been edited by Jasmine (edited 02-12-2000).]