-1
我嘗試使用JSON在rest-API中創建一個用戶。這就是成功。如何在PHP中解析POST請求並輸出JSON?
我的問題:
1)I需要接收從包含用戶信息的網絡表單POST請求?
2)添加一個APIkey並插入變量。
3)生成JSON發送到頁面:
rest.domain.com/api/v1/UserCreate
POST請求而從MY WEBFORM(實施例)
{
"UserID":"11",
"GroupID":"22",
"MemberID":"97865454534231",
"UserFullName":"Mr Test",
"UserEmail":"[email protected]",
"UserRegistrationNumber":"9999999",
}
JSON致電API(工作json)
POST /api/v1/UserCreate HTTP/1.1
Host: rest.domain.com
APIKey: XXXXXXXXXX-XXXXXXXXX-XXXXXXXXXXX
Content-Type: application/json
{
"APIKey":"XXXXXXXXXX-XXXXXXXXX-XXXXXXXXXXX",
"UserID":"11",
"GroupID":"22",
"UserEmail" : "[email protected]",
"UserRegistrationNumber" : "9999999",
"UserFullName" : "Mr Test",
"MemberID" : "123456789",
}