Forum Moderators: phranque
Here is an abbreviated copy of the code:
sub CheckSave{
my $id = $_[0]; #passing primary key
my $url = $_[1]; #whether or not to save backup
my $savepath = $_[2];
#check web page header to see if it exists
@dat=head($url);
if (!@dat) {
print <<EOF;
<DIV STYLE="color:red;border:solid 2px red; padding:4px;">
System cannot contact the Internet to save a backup. Please contact the webmaster
or edit the web address entered.<BR>
URL: $url
</DIV>
EOF
;
die;
}
#get extension for saved file from url
$ext=$in{"cec_url"};
if ($ext =~ /\?/ ¦¦ $ext =~ /.com$/) {
#if url contains a query string, use header to return extension
#if .com address, use content_type
$ext=$dat[0];
$ext =~ s/.*\/(.*)/\1/;
} else {
#otherwise, find the file type from the url
$ext =~ s/.*\.([^\/]*)/\1/;
}
#save the new web download
$saveFile = $savepath.$id.".".$ext; #generate archive file name
$status = getstore($in{"cec_url"}, $saveFile); #check url and save copy
if (is_success($status)) {
print qq[<BR><CENTER>Backup copy saved.</CENTER>\n];
} else {
#print warning if website was not valid
print <<EOF;
<DIV STYLE="color:red;border:solid 2px red; ">
Website link not found. Archive file not saved.<BR>
Please edit this record.
</DIV>
EOF
;
}
}
2004-11-04 18:22:42 StandardContext[/arch]cgi: runCGI(envp=[{HTTP_USER_AGENT=Mozilla/4.0
(compatible; MSIE 6.0; Windows NT 5.1), HTTP_ACCEPT_ENCODING=gzip, deflate, REQUEST_METHOD=GET,
AUTH_TYPE=, HTTP_ACCEPT_LANGUAGE=en-us, SERVER_NAME=svr-arch.cecinc.com, SERVER_SOFTWARE=TOMCAT,
HTTP_HOST=svr-arch.cecinc.com, GATEWAY_INTERFACE=CGI/1.1,
X_TOMCAT_SCRIPT_PATH=C:\Program Files\Afm14\Tomcat 5.0\webapps\arch\cgi-bin\cec\msds_save_url.pl,
REMOTE_ADDR=10.100.8.70, SERVER_PROTOCOL=HTTP/1.1, PATH_INFO=, REMOTE_HOST=DTHOMPSON,
QUERY_STRING=, HTTP_CONNECTION=Keep-Alive, SERVER_PORT=80,
HTTP_COOKIE=afm_user_id_per_computer=afm; JSESSIONID=14AD0D44927B3B6A0071B70D52F5547F,
CONTENT_TYPE=, CONTENT_LENGTH=, SCRIPT_NAME=/arch/cgi-bin\cec\msds_save_url.pl, HTTP_ACCEPT=*/*,
REMOTE_USER=, REMOTE_IDENT=}], command=C:\Program Files\Afm14\Tomcat 5.0\webapps\arch\cgi-bin\cec\
msds_save_url.pl)
2004-11-04 18:22:42 StandardContext[/arch]cgi: runCGI (stderr):500
Can't connect to www.theneonweb.com:80 (Bad protocol 'tcp')
<URL:http://www.theneonweb.com/index.html>
I had to do this on my system: (from a command prompt I did "echo %SYSTEMROOT%")
$ENV{"SYSTEMROOT"} = "C:\\WINNT";
How did you figure out that was the problem?