How to forward $_POST with PHP and cURL?

前端 未结 4 1972
长发绾君心
长发绾君心 2021-01-11 13:51

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

4条回答
  •  情歌与酒
    2021-01-11 14:34

    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¶2=val2&...' or as an array with the field name as key and field data as value.

提交回复
热议问题