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

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

问题描述

我收到POST请求我的PHP脚本,并希望这个帖子呼叫转移到使用POST过另一个脚本。如何做到这一点?我可以用卷曲,如果它需要这种行动。


解决方案

也许

  curl_setopt($ CH,CURLOPT_POSTFIELDS,$ _ POST);

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

这可以作为一个urlen codeD串一样被传递'PARA1 = VAL1&安培; PARA2 = val2的&...'或与字段名一样值键和现场数据的数组。

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.

解决方案

Perhaps:

curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);

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

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.

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

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