sms
收藏资源简介:
var unirest = require("unirest"); var req = unirest("GET", "https://branded-sms-pakistan.p.rapidapi.com/send"); req.query({ "message": "bonne f%C3%AAte", "email": "consty3112%40outlook.com", "to": "<required>" }); req.headers({ "x-rapidapi-host": "branded-sms-pakistan.p.rapidapi.com", "x-rapidapi-key": "f7f846a52cmshea137933a83a963p124559jsnd9da280b818b" }); req.end(function (res) { if (res.error) throw new Error(res.error); console.log(res.body); });
// 导入unirest HTTP客户端库 var unirest = require("unirest"); // 初始化GET请求,目标为巴基斯坦品牌短信RapidAPI的短信发送接口 var req = unirest("GET", "https://branded-sms-pakistan.p.rapidapi.com/send"); // 配置请求查询参数: req.query({ "message": "节日快乐", // 原消息内容为法语"bonne fête",经URL编码后为"bonne f%C3%AAte" "email": "consty3112@outlook.com", // 原邮箱地址经URL编码后为"consty3112%40outlook.com" "to": "<必填>" }); // 配置请求头信息: req.headers({ "x-rapidapi-host": "branded-sms-pakistan.p.rapidapi.com", "x-rapidapi-key": "f7f846a52cmshea137933a83a963p124559jsnd9da280b818b" }); // 发起请求并处理响应结果: req.end(function (res) { // 若请求出错则抛出对应错误 if (res.error) throw new Error(res.error); // 打印API返回的响应体内容 console.log(res.body); });




