Re: How do I submit a POST form?

From: Date: Tue, 27 Feb 2001 22:50:18 +0000
Subject: Re: How do I submit a POST form?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-41902@lists.php.net to get a copy of this message
Search for "Rasmus Lerdorf" and "posttohost" in your fave PHP code archive or search engine. -- Visit the Zend Store at http://www.zend.com/store/ Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: "Alexis Michel Golzman" <alexis@trafficbar.com> Newsgroups: php.general Sent: Sunday, February 25, 2001 2:47 AM Subject: [PHP] How do I submit a POST form? > 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 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#41902) next »