如何使用PHP和cURL转发$ _POST? [英] How can I forward $_POST with PHP and cURL?
本文介绍了如何使用PHP和cURL转发$ _POST?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在我的PHP脚本中收到POST请求,并且也想使用POST将这个POST调用转发到另一个脚本.我该怎么办?
I receive a POST request at my PHP script and would like to forward this POST call to another script using POST too. How can I do this?
如果需要此操作,我可以使用cURL.
I can use cURL if it's required for this action.
推荐答案
也许:
curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);
来自 curl_setopt :
这可以作为诸如'para1 = val1& para2 = val2&...'的urlencoded字符串或以字段名称作为键并将字段数据作为值的数组传递.
This can either be passed as a urlencoded string like 'para1=val1¶2=val2&...' or as an array with the field name as key and field data as value.
这篇关于如何使用PHP和cURL转发$ _POST?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文