Perl Http Sockets problem...
Posted on 2001-07-05
Hi, I'm trying to write a script that will emulate the filling in of a form on a web page using the POST method.
What I have below get's a response from the site with a confirmation page but the variables in the data seem to have been ignored.
Does anyone have any idea's as to how to get this to work???
Or even if someone has some insight into HTTP that could be of use. I would be very appreciative.
$proto = getprotobyname("tcp");
socket(SLASH, PF_INET, SOCK_STREAM, $proto) or die "socket: $!";
connect(SLASH, $paddr) or die "Connect error: $!";
autoflush SLASH 1;
print SLASH "POST name_of_page.asp\nReferer:name_of_referer_page.asp HTTP/1.0\r\n\r\nDATA_IN_HERE";
local $/ = "\n%%\n";
$out .= $_;
@lines = split(/\r\n/, $out);