W
Wonder
Hello,
I'm trying to use a perl script to download some html files on a
website, but it's very strange that the response for the fetch-file is
always "404 not found", even though I have no problem to open the same
url in IE. And the same script can work for the urls of other websites.
It seems that website only allow the connection from web browser, but
not download tools ( it also denied the download request of tools like
Flashget). Is there any field I need to set up in my perl code to cheat
the remote website to make it think this is a request from the web
browser? Thanks.
The following is my code:
use LWP::UserAgent;
use HTTP::Response;
$ua = LWP::UserAgent->new;
$CurrentURL = "http://DomainName.com/RemoteFileName.html";
$filename = ".LocalFileName.html";
$response = $ua->mirror($CurrentURL, $filename);
die "Can't get $CurrentURL -- ", $response->status_line unless
$response->is_success;
I'm trying to use a perl script to download some html files on a
website, but it's very strange that the response for the fetch-file is
always "404 not found", even though I have no problem to open the same
url in IE. And the same script can work for the urls of other websites.
It seems that website only allow the connection from web browser, but
not download tools ( it also denied the download request of tools like
Flashget). Is there any field I need to set up in my perl code to cheat
the remote website to make it think this is a request from the web
browser? Thanks.
The following is my code:
use LWP::UserAgent;
use HTTP::Response;
$ua = LWP::UserAgent->new;
$CurrentURL = "http://DomainName.com/RemoteFileName.html";
$filename = ".LocalFileName.html";
$response = $ua->mirror($CurrentURL, $filename);
die "Can't get $CurrentURL -- ", $response->status_line unless
$response->is_success;