[英]mysms api login and get sms
I am developing a program to be able to send and get SMSs using MySMS .我正在开发一个能够使用MySMS发送和接收 SMS 的程序。 I have the API Key and I managed to write a code for sending SMS.我有 API 密钥,我设法编写了用于发送 SMS 的代码。 But I have a problem when trying to login to the api and get SMSs.但是我在尝试登录 api 并获取短信时遇到了问题。 I am using Postman and it is giving me response code 500 when I try to login.我正在使用 Postman,当我尝试登录时它给我响应代码 500。
https://api.mysms.com/rest/user/login https://api.mysms.com/rest/user/login
any clue on what I am doing wrong, all my data is correct but I am not sure about the format or any other thing.关于我做错了什么的任何线索,我所有的数据都是正确的,但我不确定格式或任何其他事情。
image explaining the parameters and documentation and the response code解释参数和文档以及响应代码的图像
$url = 'https://api.mysms.com/json/user/login';
$mydata = array(
'apiKey' => $apikey,
'msisdn' => $msisdn,
'password' => $password,
);
$post_data = json_encode($mydata);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$headers = array();
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
return $result;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.