My Perl script at www.anotherdomain.com/cgi-bin/bar/myscript.pl needs to redirect to an html page that is at www.mydomain.com/foo/page.htm To ensure that this page can be accessed only by a redirect from my script - I know I'll get heat for this, but bear with me - I propose to put an htaccess file in the foo directory that will accept requests only from one specific, imaginary, referer. Then, have myscript set the referer header that accompanies its redirect.
To do that, I lifted this code from here:
http://www.microsoft.com/mspress/books/sampchap/5612c.aspx
changing northwindtraders.com to mydomain.comuse HTTP::Request::Common qw(POST GET); use LWP::UserAgent; $ua = LWP::UserAgent->new(); $req = POST 'http://www.northwindtraders.com/dologin.asp', [ Username => 'mike', Password => 'mypa$w0rd', ]; $req->header(Referer => 'http://www.northwindtraders.com/login.html'); $res = $ua->request($req);
But it doesn't work for me. I get the dreaded Server Error.
Any advice on either how to make this code work, or other ways to do the same thing, would be greatly appreciated.
Thanks.
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |