接口文檔

秒賽為開發者提供了詳細的API文檔和代碼示例,幫助開發者快速接入短信平臺

C++短信接口_C++短信發送代碼示例

2020-03-10 14:51:21 欄目:代碼示例 查看( )
本文分享C++短信接口代碼,為方便用戶接入網站/app/各種系統,感興趣的小伙伴們可以參考一下。

#include <stdio.h>
#include <curl/curl.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#define MAXPARAM 2048
CURL*curl;
CURLcoderes;
/**
 * 本樣例依賴libcurl庫
 * 下載地址 https://curl.haxx.se/download.html
 */
/* 短信內容 */
char *msg = "【秒賽科技】您的驗證碼是:1234";
/* 發送url 請咨詢客服 */
char *url = "http://139.196.108.241:8080/Api/HttpSendSMYzm.ashx";
void send_data( char *url, char *data )
{
/* specify the url */
curl = curl_easy_init();
curl_easy_setopt( curl, CURLOPT_URL, url );
printf"url:%s ", url );
/* specify the POST data */
curl_easy_setopt( curl, CURLOPT_POSTFIELDS, data );
printf"data:%s ", data );
/* get response data */
CURLcode res = curl_easy_perform( curl );
printf"%d ", res );
/* printf(" "); */
}
/**
 * 發送短信
 */
void send_sms( char *url, char *account, char *pswd, char *mobile, char *msg )
{
charparams[MAXPARAM + 1];
char*cp = params;
sprintf( params, "account=%s&pswd=%s&mobile=%s&msg=%s&needstatus=true", account, pswd, mobile, msg );
send_data( url, params );
}
int main( void )
{
/* 賬號 */
char *account = "您的賬號";
/* 密碼 */
char *pswd = "您的密碼";
/* 修改為您要發送的手機號 */
char *mobile = "手機號";
/* 發送驗證碼短信 */
send_sms( url, account, pswd, mobile, msg );
return(0);
}
微信掃一掃

認證、簽名模板審核結果通知

賬號短信余額不足提醒

平臺促銷活動及最新資訊

鄭重申明:①任何個人和或機構在未經過本人同意的情況下,不得擅自轉載或大段引用到網站或者第三方平臺使用,對于擅自盜用文章將通過法律訴訟途徑等一切手段來解決!②部分素材來源于互聯網,如有侵權,請聯系作者刪除!