Thank you for the advice Paul.
I have used LWP to get the file and this works well, from the command line. I am now trying to display the file I have retrieved in a browser (using the CGI module).
Unfortunately, I reveive the following message each time:
[red]
"Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, xxxxx@mydomain.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log."
[/red]
In the error log I see:
[red]
"[Wed Jun 04 09:15:48 2003] [error] [client 192.168.0.2] (22503)The system cannot find the path specified. : couldn't create child process: 22503: remote.pl
[Wed Jun 04 09:15:48 2003] [error] [client 192.168.0.2] (22503)The system cannot find the path specified. : couldn't spawn child process: C:/apache/cgi-bin/remote.pl"
[/red]
This is my scipt:
[red]
#!F:\Applications\Perl\bin\perl.exe -w
use CGI ':standard';
use LWP::UserAgent;
use strict;
#File to get:
my $url = '
#Frame header
print "Content-type: text/html\n\n";
print <<"HEADER";
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
<html>
<head></head>
<body>
HEADER
##Get remote file##
#Create a user agent object
my $ua = LWP::UserAgent->new;
#Create a request
my $req = HTTP::Request->new( GET => $url );
#Pass request to the user agent to get webpage
my $response = $ua->request($req);
#Check the outcome of the response
unless ($response->is_success){
print "Could not find the page at $url</body></html>";
exit;
}
print $response->content;
#Frame Footer
print <<"FOOTER";
</body>
</html>
FOOTER
[/red]
If anyone can help me with what causes this error (I'm sure it's something simple with my use of CGI) then I would very much appreciate your help.
Many thanks for your time.
Regards,
James.