in reply to Re^3: redirecting, html forms, mechanize
in thread redirecting, html forms, mechanize
thank you so much for your time and effort.
After spending some time reading about mod_rewrite, I got the feeling that it is not really what I need. It seems mod_rewrite's intention is to handle complex redirections (and that it becomes really powerful in large networks). Too many bad experiences with "misusing" programs / servers for my needs made me stepping back using it.
After doing more research about http, I realised what I really want is a redirect response back from my cgi.My script above was good, I only needed to change the _location to the requesting one in the http header.
#!/usr/bin/perl use warnings; use strict; use Data::Dumper; use WWW::Mechanize; use CGI qw/:standard/; use CGI::Carp qw(warningsToBrowser fatalsToBrowser); my $q = new CGI; my $addr = $ENV{'REMOTE_ADDR'}; my $m = WWW::Mechanize->new(); my $url = 'http://projects.villa-bosch.de/dbase/molsurfer/submit-elec. +html'; $m->get($url); $m->add_header(location => $addr); $m->set_fields( FILE1 => $file1, FILE2 => $file2, mapsize =>'59x59', resolution =>'med', pdie =>'4', sdie =>'80', ioss =>'150', ionr =>'1.5', nmap =>'0.0' ); my $response = $m->submit(); print $q->header; print $response->content();
|
|---|