使用PHP和Json发出POST请求

时间:2019-11-28 13:19:17

标签: javascript php html json

伙计们........我需要提示如何使用json和php发出帖子。.

我是json的新手,所以我真的不了解他们的代码结构...我得到了几行json代码以使用api。下面是代码。

{
  "secret_key": "<YOUR SECRET KEY>",
  "service": "fly_buy",
  "service_method": "post",
  "service_version": "v1",
  "service_channel": "rave",
  "service_payload": {
    "Country": "",
    "CustomerId": "+1111111111",
    "Reference": "9300049404444",
    "Amount": 0,
    "RecurringType": 0,
    "IsAirtime": true,
    "BillerName": "AIRTIME"
  }
}

这是我发送请求的html表单代码


<div id="bills2" class="container-fluid">
  <div class="row">
   <!–– List group item ––>
    <div id="airtime_panel" class="container">
<form class="jumbotron">
  <div class="form-group" align="center">

  </div>

    <div class="form-group">
    <input type="text" class="form-control" id="CustomerId"  placeholder="Mobile Number">
  </div>
  <div class="form-group">
    <input type="email" class="form-control"  placeholder="E-mail">
  </div>
  <div class="form-group">
    <input type="text" class="form-control" id="Amount" placeholder="Amount">
  </div>
  <div  class="row" align="center">
  <div class="col" align="center">
   <button type="submit" id="submit" class="btn btn-outline-warning">Buy Airtime</button>
   <button class="btn btn-outline-danger" onclick="history.go(-1);">Back </button>
 </div>
 </div>
</form>
   </div>

</div>


我想知道自己是否做对了。谢谢

0 个答案:

没有答案