RE: [PHP] Headers

From: Date: Thu, 26 Jul 2001 05:02:27 +0000
Subject: RE: [PHP] Headers
Groups: php.general 
Request: Send a blank email to php-general+get-59679@lists.php.net to get a copy of this message
To emulate a post you'll have to do something similar to the following header "POST /index.php3 HTTP/1.1"; header "Host: $host"; header "Content-type: application/x-www-form-urlencoded" ; header "Content-length: ". strlen ($data); header "Connection: close\n\n"; //may only need one, can't remember if header postpends \n //Now print variables //var1=information&var2=more //for each var to submit header "$$var1=$var1&$$var2=$var2"; or function PostToHost($host, $path, $data_to_send) { $fp = fsockopen($host,80); fputs($fp, "POST $path HTTP/1.1\n"); fputs($fp, "Host: $host\n"); fputs($fp, "Content-type: application/x-www-form-urlencoded\n"); fputs($fp, "Content-length: ".strlen($data_to_send)."\n"); fputs($fp, "Connection: close\n\n"); fputs($fp, $data_to_send); while(!feof($fp)) { echo fgets($fp, 128); } fclose($fp); } $host = "cgiserver.x.com"; // target server $path = "/cgi-bin/target.cgi"; // cgi's name $string = "value1=value1&value2=value2" ; // There can be more value PostToHost("$host","$patha","$string"); // call the function Cheers, Lawrence. -----Original Message----- From: Christian Reiniger [mailto:creinig@mayn.de] Sent: July 26, 2001 12:32 PM To: Richard Baskett; PHP General Subject: Re: [PHP] Headers On Wednesday 25 July 2001 15:24, Richard Baskett wrote: > What does the header look like when you submit a form using the POST > method? I would like to transfer some php variables to another page > using the header() function. The Location part I have down no problem, > but I don't want to do something like this: > > header(Location:mypage.html?variable1=total) > > This shows all the variables in the URL. Is there a way to use a > header to POST variables to the Location part of the header? Header () is for altering the HTTP headers sent back to the browser. Read some HTTP intro. Regarding your problem - have a look into sessions. they might be what you want. -- Christian Reiniger LGDC Webmaster (http://lgdc.sunsite.dk/) Error 032: Recursion error - see error 032 -- 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 (#59679) next »