CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

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

 



Spyros
Deleted

Feb 8, 2000, 11:28 AM

Post #1 of 2 (2409 views)
Need a perl program Can't Post

Hello,
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.


Jasmine
Administrator

Feb 11, 2000, 10:51 PM

Post #2 of 2 (2409 views)
Re: Need a perl program [In reply to] Can't Post

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";
}
</pre><HR></BLOCKQUOTE>

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

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives