Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting a remote file

Status
Not open for further replies.

audiopro

Programmer
Joined
Apr 1, 2004
Messages
3,165
Location
GB
I am trying to get a file from a remote server.

I have got this code from CPAN for the Get() command which seems to be the right thing but, it just locks up.

I have changed the domain name for security but the file name I used was pasted from the address bar so is correct.
I also tried an incorrect filename and the script refused to die.
The same problem if I remove the print statements.
Am I missing something obvious here?

Code:
#!/bin/perl
use CGI::Carp qw(fatalsToBrowser);
use strict;
use LWP::Simple;
print "Content-type: text/html\n\n";	# prepare for HTML output
my $content = get("[URL unfurl="true"]http://www.mydomain.co.uk/dir/file.ext");[/URL]
die "Couldn't get it!" unless defined $content;
print "$content";

Keith
 
How large is the file? If we're talking hundreds of megabytes in size, your script would lock up because it would run out of memory, because it tries to put the whole file contents into the variable $content

-------------
Cuvou.com | The NEW Kirsle.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top