发送所有的$ _POST []值到"nextpage". [英] sending all $_POST[] value to "nextpage."

查看:72
本文介绍了发送所有的$ _POST []值到"nextpage".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我在表单方法POST中有很多值

Suppose i have many values here with form method POST

$_POST["value1"]
$_POST["value2"]
$_POST["value3"]
$_POST["value4"]
$_POST["value5"]
$_POST["value6"]
$_POST["value7"]

,我想将它们发送到nextpage.php

有什么功能可以做到吗?除了使用

any function to do that? Besides using

<form method="POST" action="nextpage.php">
<input type="hidden" name="value1"  value="value1 />
</form>

推荐答案

要将帖子值传递到下一页,请将完整的$ _POST超全局数组变量存储到 session 中,然后在下一页上可以访问它们使用 $ _ SESSION 变量

For passing post values to next page store the complete $_POST superglobal array variable into session and then on next page you can access those values using $_SESSION variable

或者,您可以使用 curl 通过POST方法将HTTP请求发送到下一页 然后可以使用下一页的$ _POST变量来访问这些变量

Alternatively you can use curl to send HTTP request to next page using POST method Then those variables will be accessible using $_POST variable on next page

请参考下面提到的代码段作为通过curl通过post方法发送HTTP请求的示例

Please refer the code snippet mentioned below as an example for sending HTTP request using post method through curl

        $url='http://203.114.240.77/paynetz/epi/fts';
 $data = array('login' => '11','pass' => 'Test@123','ttype'  =>'NBFundTransfer','prodid'=>'NSE','amt'=>50,'txncurr'=>'INR','txnscamt'=>0,'clientcode'=>007,'txnid'=>uniqid(),'date'=>date('d/m/Y H:i:s'),'custacc'=>'123456789');
      $datastring = http_build_query($data);
     //die($url.'?'.$datastring);
      $ch=curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_TIMEOUT, 180);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $datastring);
     $output = curl_exec($ch);
      //echo $output; die;
    curl_close($ch);

这篇关于发送所有的$ _POST []值到"nextpage".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆