flappy has asked for the wisdom of the Perl Monks concerning the following question:
I've been programming in PERL now for quiet a while but I've come across a situation that I havent encounted before and I am ripping my hair out trying to figure out how to do... I have a form on a webpage that sends data to my PERL script when you hit the submit button - nothing unusual there, but then within my PERL script I need it to post off variables to another webpage and load that page up (basicly simulating a form post within PERL). I've tried various different ways that people have shown me and all of them dont work! It cant be that hard can it?
Do I need to use sockets? or can it just be accomplished with just a simple HTTP header? ... also I want to steer clear of the CGI and LWP modules... just raw code cause its the best!... thanks in advance...
Am I heading in the right direction doing it this way? I don't know...
use IO::Socket; $host="localhost"; $path="/cgi-bin/display_passed_args.pl"; $str="test1=foo&test2=bar"; $sock = IO::Socket::INET->new("$host:80"); $sock->autoflush(); print $sock "POST $path HTTP/1.0\n"; print $sock "Host: $host\n"; print $sock "Content-type: application/x-www-form-urlencoded\n"; print $sock "Content-length: ".length($str)."\n"; print $sock "Connection: close\n\n"; print $sock $str;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jeffa) Re: Simulating Form Posts from within Perl
by jeffa (Bishop) on Aug 02, 2002 at 03:37 UTC | |
by flappy (Novice) on Aug 02, 2002 at 03:56 UTC | |
|
Re: Simulating Form Posts from within PERL
by dws (Chancellor) on Aug 02, 2002 at 06:55 UTC | |
|
Re: Simulating Form Posts from within PERL
by Dog and Pony (Priest) on Aug 02, 2002 at 07:31 UTC | |
|
Re: Simulating Form Posts from within PERL
by moxliukas (Curate) on Aug 02, 2002 at 10:46 UTC | |
|
Re: Simulating Form Posts from within PERL
by rse (Initiate) on Aug 02, 2002 at 16:44 UTC | |
|
Re: Simulating Form Posts from within PERL
by sauoq (Abbot) on Aug 03, 2002 at 02:06 UTC |