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>


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);
    解决 无用
    打赏 举报

相关推荐 更多相似问题