Re: post without form

From: Date: Wed, 16 Aug 2000 14:33:27 +0000
Subject: Re: post without form
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-12008@lists.php.net to get a copy of this message
> 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

« previous php.general (#12008) next »