punch_card_don has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Setting referer with HTTP::Request and LWP::UserAgent
by Anonymous Monk on Mar 07, 2009 at 15:37 UTC | |
by punch_card_don (Curate) on Mar 07, 2009 at 16:46 UTC | |
by Anonymous Monk on Mar 07, 2009 at 16:55 UTC | |
by punch_card_don (Curate) on Mar 07, 2009 at 17:00 UTC | |
by Anonymous Monk on Mar 07, 2009 at 17:39 UTC | |
|
Re: Setting referer with HTTP::Request and LWP::UserAgent
by Anonymous Monk on Mar 07, 2009 at 15:33 UTC |