Perl Basics
Introduction to Perl
FAQ's
CGI
Regular Expressions

PC Overview
Cool Stuff
My Modules
Success Stories
Links
Perl in the News
Logos

PC Internals
About
Contact
Handy Logos
What's new

send-cookie-from-client

See also
P-friendly

[ home ] - [ search ] - [ sitemap ]


[ up ]

Example (http)

#!/usr/bin/perl -w
use strict;

use LWP::UserAgent;
use HTTP::Request::Common;
require HTTP::Headers;

&main();

sub main() {
	my $ua = LWP::UserAgent->new(agent => 'Bugzilla 4.711 ;-)');

	my %tags = ();
	$tags{'action'} = 'my action value';
	$tags{'id'    } = 'my id value äöü';

	my $h = HTTP::Headers->new(Date => 'Thu, 03 Feb 1994 00:00:00 GMT');
	   $h->push_header(Cookie => 'foo=foobar; path=/; expires=Sun, 27-Sep-2037');
	   $h->push_header(Cookie => 'bar=barfoo; path=/; expires=Sun, 27-Sep-2037');

	my $r = HTTP::Request->new(
		POST => 'http://www.example.com/cgi-bin/foo.pl', $h
	);

	$r->content("foo=foobar&bar=barfoo");

	print $r->as_string, "\n------------------------------\n";

	my $resp = $ua->request($r);

	print $resp->error_as_HTML unless $resp->is_success;
	print $resp->content();
}
home - feedback - search

$Id: send-cookie-from-client.htm,v 1.10 2004/03/11 17:50:01 reto Exp $
© 1998-2004 reto :)