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;
In reply to Simulating Form Posts from within PERL by flappy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |