drzrdc1766788 2012-07-29 01:12
浏览 37
已采纳

PHP post数组和curl提交

I have built a form submission consisting of about 90 values. The form needs to be submitted to another page that has a curl session which handles the last part. My question is, when I submit that form, how do I access the $_Post[] data as a whole array so I can submit it as the curl post array?

need to get

<form name="send" action="process.php" method="post">
<input 1>
<inpit 2>
...
<input 90>
</form>

to

process.php :

curl_setopt( $ch, CURLOPT_POSTFIELDS, $_Post[] );

Or is it as easy as putting $Post[]?

  • 写回答

1条回答 默认 最新

  • douyong5476 2012-07-29 01:23
    关注

    From the manual, the CURLOPT_POSTFIELDS value can be in a query-string format, var1=value1&var2=value2... or in an array format with the key being the field name, such as you have with $_POST.

    You are currently using $_POST[] in your example; drop the [] and it should work fine:

    curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料