Re: post without form

From: Date: Wed, 16 Aug 2000 18:12:20 +0000
Subject: Re: post without form
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-12087@lists.php.net to get a copy of this message
Thanks alot!!! This was just what I wanted!!! On Thu, 17 Aug 2000, Jason Brooke wrote: > > > Is it posible to post certain variables without using a form? > > I need a Location to send with it some variables, but don't know how to do > > it. Is it posible? > > > > TIA > > $host = "your.host.com"; > $port = 80; > $postdata = "field1=value1&field2=value2&field3=value3"; > > if ($sp = fsockopen($host,$port)) { > > fputs($sp,"POST /path/to/somescript/php HTTP/1.0\n"); > fputs($sp,"Host: $host\n"); > fputs($sp,"Content-type: application/x-www-form-urlencoded\n"); > fputs($sp,"Content-length: ".strlen($postdata)."\n"); > fputs($sp,"Connection: close\n\n"); > fputs($sp,$postdata); > > // optionally print the response > while (!feof($sp)) { > echo fgets($sp,128); > } > > fclose($sp); > > } > > > jason > > > > > "And I'm happy, because you make me feel good, about me." - Melvin Udall ----------------------------------------------------------------- Martín Marqués email: martin@math.unl.edu.ar Santa Fe - Argentina http://math.unl.edu.ar/~martin/ Administrador de sistemas en math.unl.edu.ar -----------------------------------------------------------------

« previous php.general (#12087) next »