I just do HTTP Post like this without using any library,
sub post {
local($host,$port,$request,$data) = @_;
($fqdn, $aliases, $type, $len, $thataddr) = gethostbyname($host);
$that = pack($sockaddr, &AF_INET, $port, $thataddr);
socket(FS, &AF_INET, &SOCK_STREAM, $proto) || return undef;
bind(FS, $thissock) || return undef;
local($/);
unless (eval q!
$SIG{'ALRM'} = "timeout";
alarm($timeout);
connect(FS, $that) || return undef;
select(FS); $| = 1; select(STDOUT);
print FS "POST $request HTTP/1.0\r\n$referer";
print FS "$useragent";
print FS "Host: $host:$port\r\n$mimeaccept";
print FS "$cnt_type";
$len = length($data);
print FS "Content-length: $len\r\n\r\n$data\r\n";
undef($page);
$/ = "\n";
$_ = <FS>;
if (m:HTTP/1.0\s+\d+\s+:) { #HTTP/1.0
while(<FS>) {
last if /^[\r\n]+$/; # end of header
}
undef($/);
$page = <FS>;
}
else { # old style server reply
undef($/);
$page = $_;
$_ = <FS>;
$page .= $_;
}
$SIG{'ALRM'} = "IGNORE";
!) {
return undef;
}
close(FS);
$page;
}
I use this with a real old server (first generation Apache httpd). It doesn't support HTTP/1.1, chunked encoding etc but you get the idea.