Home: Perl Programming Help: Advanced:
POSTing difficulty with libwww-perl


Jul 4, 2000, 9:08 PM

Views: 1685
POSTing difficulty with libwww-perl

This is as much a question about how a browser works as how to POST a form.

I've got a client that needs an automated solution for accessing and testing remote scripts. I've been able to set things up with good results with LWP::UserAgent, but I am having difficulty when it comes to FORMs that have a virtual path for the action parameter.

I can create an HTTP::Request POST with the actual path to most scripts... http://www.wherever.com/cgi-bin/script.cgi

But in one of the cases the FORM action="../script.exe" and is below the site home folder. I can't just do HTTP::Request POST => http://www.whatever.com/../script.exe, and of course HTTP::Request POST => ../script.exe won't work as the HTTP::Request does not know where to submit it. My client is unable to move the script at the moment, he needs it tested where it is at.

Somehow, the browser is able to submit ../script.exe to the originating server, but I am unable to figure out what parameter in LWP::UserAgent or HTTP::Request is able to mimic this action.

Any suggestions or resources?

Chris Hemming
Digital Stone Productions


Jul 6, 2000, 4:56 PM

Views: 1685
Re: POSTing difficulty with libwww-perl

relative urls work afaik.. at least they do in LWP::Simple
if http://www.whatever.com/../script.exe
is what you are actually using that would be the problem right there; you are trying to go up from the root.. probably something like http://www.whatever.com/home/../cgi-bin/script.exe would work. Make sure that when you use a relative url your base url is correct. If this doesn't work as you want, the LWP has modules to fully expand an url for you. You could probably just use this when grabbing the page itself..