Redirect with POST data

前端 未结 4 1946
野的像风
野的像风 2020-12-19 18:55

I am working on a shopping cart with several payment options using different APIs.

The flow I want is that the user chooses which payment option to use and the accor

4条回答
  •  囚心锁ツ
    2020-12-19 19:18

    If you have the PECL http extension installed (it'll show up in phpinfo() as pecl_http) you can create an HTTP POST request and spit out the results after the following pattern:

    // your DB code above here
    $pay_request = new HttpRequest($remote_url, HTTP_METH_POST);
    $pay_request->addPostFields($_POST);
    $pay_request->send()->send();
    

    Last line's not a typo - the request returns a response, and then the response gets dumped in the output buffer.

提交回复
热议问题