L
Larry
Hi,
I would like to know how to go about using the following code to send
some data to a web server using POST method:
#!/perl
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
$ua->agent("Naiocast/1.8 (Stable Version)");
my $req = HTTP::Request->new(POST =>
'http://127.0.0.1:8000/cgi-bin/recv.cgi');
$req->content_type('application/octet-stream');
my $res = $ua->request($req);
print $res->as_string;
__END__;
I'm not going to send form data. Instead, I'm sending raw binary data
which I'm not aquainted with the size, so I may as well set a long
content-length
I'm getting binary data from a local sysread:
while ( sysread($sock, $buf, BUFSIZE) )
{
# ...send $buf via POST...(let LWP handle it)
}
Can it atually be done?
thanks
I would like to know how to go about using the following code to send
some data to a web server using POST method:
#!/perl
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
$ua->agent("Naiocast/1.8 (Stable Version)");
my $req = HTTP::Request->new(POST =>
'http://127.0.0.1:8000/cgi-bin/recv.cgi');
$req->content_type('application/octet-stream');
my $res = $ua->request($req);
print $res->as_string;
__END__;
I'm not going to send form data. Instead, I'm sending raw binary data
which I'm not aquainted with the size, so I may as well set a long
content-length
I'm getting binary data from a local sysread:
while ( sysread($sock, $buf, BUFSIZE) )
{
# ...send $buf via POST...(let LWP handle it)
}
Can it atually be done?
thanks