|
|
14.02.2006
[ See also: LWP Cookies ] #!/usr/bin/perl -w
use LWP::UserAgent;
use HTTP::Request::Common;
my $ua = LWP::UserAgent->new(agent => 'Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)');
my %tags = ();
$tags{'action'} = 'my action value';
$tags{'id' } = 'my id value';
# X my $h = HTTP::Headers->new(Date => 'Sun, 27 Sep 2037 00:00:00 GMT');
my $h = HTTP::Headers->new();
$h->push_header(Cookie => 'CFID=4607172; path=/; CFID=4607172; expires=Sun, 27-Sep-2037 00:00:00 GMT;
path=/; domain=.sunrise.ch; CFMAGIC=4607172%3A91619481; path=/; CFMAGIC=4607172%3A91619481; expires=Sun,
27-Sep-2037 00:00:00 GMT; path=/; domain=.sunrise.ch; CFTOKEN=91619481; path=/; CFTOKEN=91619481; expires=Sun,
27-Sep-2037 00:00:00 GMT; path=/; domain=.sunrise.ch; REQID_ID=0; path=/;');
my $r = HTTP::Request->new(
POST => 'http://example.com/cgi-bin/foo.pl', $h,
# XXX Content => [ %tags ] ,
Content_Type => 'form-data' # XXX 'application/x-www-form-urlencoded' ,
);
$r->content("foo=bar&bars=foos");
print $r->as_string, "\n------------------------------\n";
my $resp = $ua->request($r);
print $resp->error_as_HTML unless $resp->is_success;
print $resp->content();
Output
CGI Parameters received:
| |||||||||||||
copyright by reto - created with mytexi