如何使用PHP和cURL转发$ _POST? [英] How to forward $_POST with PHP and cURL?

查看:341
本文介绍了如何使用PHP和cURL转发$ _POST?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的PHP脚本接收POST请求,并希望使用POST转发这个post调用到另一个脚本。如何做到这一点?

I receive POST request at my PHP script and would like to forward this post call to another script using POST too. How to do this? I can use cURL if it's required for this action.

推荐答案

也许:

curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);

http://www.php.net/manual/en/function.curl-setopt.php

这可以像'para1 = val1& para2 = val2&...'这样的字符串形式的字符串传递,也可以作为字段名为键和字段数据为值的数组传递。
This can either be passed as a urlencoded string like 'para1=val1&para2=val2&...' or as an array with the field name as key and field data as value.

这篇关于如何使用PHP和cURL转发$ _POST?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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