php POST variable with headers

2019-08-04 05:20发布

This is the code:

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

Then I use $_GET['id'] to get the value. So far so good.

Question: How can I do that by POSTING the variable instead and without using session??

Thanks,

George

2条回答
时光不老,我们不散
2楼-- · 2019-08-04 05:48
$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);
查看更多
混吃等死
3楼-- · 2019-08-04 06:05
$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;

I think that you have to fill such form, and then send it.

查看更多
登录 后发表回答