How do I submit a POST form?

From: Date: Sun, 25 Feb 2001 08:50:57 +0000
Subject: How do I submit a POST form?
Groups: php.general 
Request: Send a blank email to php-general+get-41564@lists.php.net to get a copy of this message
Hi, I've submitted many times a GET form like this: header("Location: http://examplesite.com/myscript.php3?key=value&key2=value2&keyn=valuen"); but now I need to submit a POST form. How is this done? I found this Perl code on the web: -------------------------------------------------------------- use strict; use LWP::UserAgent; # libwww-perl my $ua = new LWP::UserAgent or die "new UA: $!"; $ua->agent("testclient/1.0"); my $url = 'http://localhost/cgi-bin/test.pl'; my $request = new HTTP::Request('POST', $url) or die "new HTTP::Request POST '$url': $!"; $request->content_type('application/x-www-form-urlencoded'); $request->content('field1=value1&field2=value2&field3=value3'); #$request->content('field1=value1'); # optional method #$request->add_content('&field2=value2'); #$request->add_content('&field3=value3'); my $response = $ua->request($request); print $response->content; -------------------------------------------------------------- But I want to know if there is a way of doing it in PHP... Thanks in advance for your help! :-) Kind regards, Alexis Golzman mailto:alexis@trafficbar.com http://trafficbar.com

« previous php.general (#41564) next »