在php

时间:2017-03-13 07:03:11

标签: php json laravel

请求标题

Content-Type: application/json 
Authorization: Bearer [access token] 
Accept: application/json

如果发送带有消息的unicode字符串,请将Content-Type字符集设置为UTF-8

以下是发送服务的示例请求。

URL - https://example.com/requests

方法 - POST

{
    "outboundSMSMessageRequest": {
        "address": [
            "tel:+94771234567"
        ],
        "senderAddress": "tel:12345678",
        "outboundSMSTextMessage": {
            "message": "Test Message"
        },
        "clientCorrelator": "123456",
        "receiptRequest": {
            "notifyURL": "http://128.199.174.220:1080/sms/report",
            "callbackData": "some-data-useful-to-the-requester"
        },
        "senderName": "ACME Inc."
    }
}

如何发布并获得回应

1 个答案:

答案 0 :(得分:0)

AJAX

headers: {
    'X-HTTP-Method-Override': 'POST',
    'Content-Type': 'application/json'
},

或vanilla js

How to create javascript POST request to server with Headers and Data