带有标题的php POST变量

时间:2011-06-09 22:31:48

标签: php post header get

这是代码:

header("Location: checkout/transactionCompleted.php?id=".$transactionId);

然后我使用$_GET['id']来获取值。到目前为止一切都很好。

问题:如何通过POST变量而不使用会话来做到这一点?

谢谢,

乔治

2 个答案:

答案 0 :(得分:2)

$post_data = 'id='.$transactionId;
$content_length = strlen($post_data);

header('POST checkout/transactionCompleted.php');
header('Host: localhost');
header('Connection: close');
header('Content-type: application/x-www-form-urlencoded');
header('Content-length: ' . $content_length);
header('');
header($post_data);

答案 1 :(得分:1)

$http_request  = "POST $path HTTP/1.0\r\n";
$http_request .= "Host: $host\r\n";
$http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
$http_request .= "Content-Length: " . strlen($req) . "\r\n";
$http_request .= $req;

我认为您必须填写此表格,然后发送。