note 89447 deleted from function.header by danbrown

From: Date: Tue, 23 Feb 2010 18:24:59 +0000
Subject: note 89447 deleted from function.header by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-166296@lists.php.net to get a copy of this message
Note Submitter: rbawaskar at gmail dot com ---- Found this script after much despair, should be useful to lot of people. To submit a form using POST method through PHP, just add the data to be posted as header. This essentially saves one extra html page sent to the browser when user has to be redirected. Mostly found this technique useful for redirecting to payment gateways. <?php $host = "www.example.com"; $path = "/path/to/script.php"; $data = "data1=value1&data2=value2"; $data = urlencode($data); header("POST $path HTTP/1.1\r\n" ); header("Host: $host\r\n" ); header("Content-type: application/x-www-form-urlencoded\r\n" ); header("Content-length: " . strlen($data) . "\r\n" ); header("Connection: close\r\n\r\n" ); header($data); ?>

« previous php.notes (#166296) next »