######### The Page you want the script to fetch.###### my $return_URL = "http://123.123.123.123/cgi-bin/index.pl"; # The location of the file the HTML is saved as. my $file = 'D:/Inetpub/Scripts/fetchtest/images/url.html'; # The URL to the local directory the images are saved in. my $images_url = 'https://my-secure-domain/cgi-bin/fetchtest/images/'; # The local server path to the directory the images are saved in. my $images_path = 'D:/Inetpub/Scripts/fetchtest/images'; # The local server path to the directory this script is in. my $cgi_path = 'D:/Inetpub/Scripts/fetchtest'; # The Local URL of the .HTML file. my $html_file = 'http://192.168.0.4/cgi-bin/fetchtest/images/url.html'; use strict; use LWP::Simple; use HTML::TokeParser; use URI; my $query_string = $ENV{"QUERY_STRING"}; my $return_query = "$return_URL?$query_string"; $return_query = "http://$return_query" unless $return_query =~ m{^http://}; my $url = URI->new($return_query); # Get requested page and save it locally #print "Retrieving $return_query...\n"; my $html = get($return_query) || ''; open(OUTPUT_FILE, ">$file") || die "Unable to open $file: $!"; flock(OUTPUT_FILE,2) or die "cannot lock file: $!"; print OUTPUT_FILE $html; close(OUTPUT_FILE);