我正在尝试使用smsgateway.me发送短信
有些文档我遵循所有说明,但仍然得到以下答复。
回复:
{"status":"fail","message":"Could not process request","data":{"exception":"Invalid input"}}
端点:https://smsgateway.me/api/v4/message/send
方法: POST
请求参数
名称:授权
位置:标头
说明:您的API令牌
内容主体: JSON有效负载以及API应该发送的SMS消息的信息
请求示例
[
{
"phone_number": "07791064781",
"message": "Hello World",
"device_id": 1
},
]
我的代码
<?php
$url = 'https://smsgateway.me/api/v4/message/send';
$payload = json_encode( array( "phone_number"=> "03336458112", "message"=> "Geind", "device_id"=> 103931 ) );
$token = 'a-b-c-d-e-f-g';
$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_POSTFIELDS, "Content=".$payload );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type:
application/json', 'Authorization:'. $token ));
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
$result = curl_exec($ch);
curl_close($ch);
echo "<pre>$result</pre>";