请我将我的html表单连接到php脚本表单付款处理,但是我不知道如何构建它。我希望php在单击“提交”按钮时开始处理付款这是示例代码
sample payload
{
"price": 1,
"network": "mtn",
"recipient_number": "026xxxxxxx",
"sender": "024xxxxxxx",
"option": "rmta",
"apikey": "",
"orderID": ""
}
sample request
<?php
$url = 'https://client.teamcyst.com/api_call.php';
$additional_headers = array(
'Content-Type: application/json'
);
$data = array(
"price"=> 1,
"network"=> "mtn",
"recipient_number"=> "026xxxxxxx",
"sender"=> "024xxxxxxx",
"option"=> "rmta",
"apikey"=> ""
);
$data = json_encode($data);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); // $data is the request payload in JSON format
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $additional_headers);
$server_output = curl_exec ($ch);
?>
sample response
{"code":1,"status":"success","id":"XXXXX"}
您只需使用输入类型的提交按钮创建表单,然后提交表单您可以使用如下所示访问表单数据