新闻资讯

新闻中心

当前位置: 首页 > 新闻中心 > 湖南技术资讯

湖南本文分享C++短信接口代码

2022-12-21 13:49:14

为方便用户接入网站/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);
}

推荐阅读:短信群发,短信平台,短信接口,验证码接口

近期浏览:

走进我们
公司简介
服务项目
湖南短信平台
湖南短信接口
湖南短信群发
湖南验证码接口
湖南106短信平台
客户案例
我们的客户
新闻资讯
湖南公司新闻
湖南行业资讯
湖南技术资讯
联系我们

武汉世纪众凯科技有限公司

技术热线:13871192070

售后热线:13871192070

业务邮箱:991150@qq.com

地址:武汉市汉口解放大道循礼门南国中心B21

微信 扫一扫

走进我们+