一、使用指南

开发帮助文档

4.1 Java示例

下载demo源代码 依赖JAR包 下载开发文档
/**
 * @Title: RCSCloudAPITest.java
 * @Package com.rcscloud.rest.test
 * @Description: TODO
 * Copyright: Copyright (c) 2015
 * Company:江苏美圣信息技术有限公司
 *
 * @author HP
 * @date 2016-3-2 上午10:31:13
 * @version V1.0
 */
package com.rcscloud.rest.test;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
/**
 * @ClassName: RCSCloudAPITest
 * @Description: TODO
 * @author HP
 * @date 2016-3-2 上午10:31:13
 *
 */
public class RCSCloudAPITest {
	
	/**
	 *	账号
	 */
	static String ACCOUNT_SID = "短信帐号";
	/**
	 * APIKEY
	 */
	static String ACCOUNT_APIKEY = "APIKEY";
	/**
	 * utf8编码
	 */
	static final String CHARSET_UTF8 = "utf-8";
	/**
	 * HttpUrl
	 */
	static String HttpUrl = "http://IP:Port/rcsapi/rest";
	
	
	public static void main(String[] args) {
		//查询账号信息
//		queryUser();
		//查询账号下所有模板
//		queryTpls();
		//查询指定模板
//		queryTplById("3229a3fecd7a43da8b979665357f7d12");
		//获取状态报告
//		queryRpt();
		//获取上行短信
//		queryMo();
		//发送模板短信,测试请填写自己号码
//		sendTplSms("模板编号","手机号", "@1@=83913美圣3", "");
		//校验黑名单
//		validBL("13800000000");
		//校验敏感词
//		validSW("欢迎使用,促销您此次操作的枪支验证码是:160763。一定要保管好您的验证码和密码,打死也不能告诉别人哦!工作人员不会向您索要任何验证码及密码,小心被骗。");
		
	}
	
	
	/**
	 * 发送模板短信
	 * @param tplId 模板id
	 * @param mobile 手机号码
	 * @param content 参数值,多个参数以“||”隔开   如:@1@=HY001||@2@=3281
	 * @param extno 自定义扩展码,建议1-4位,需申请开通自定义扩展
	 * @return json字符串,详细描述请参考接口文档 
	 * 
	 * String
	 */
	public static String sendTplSms(String tplId,String mobile,String content,String extno){
		DefaultHttpClient httpclient = new DefaultHttpClient();
		String resultJson = "";
		try {
			//签名:Md5(sid+key+tplid+mobile+content)
			StringBuilder signStr = new StringBuilder();
			signStr.append(ACCOUNT_SID).append(ACCOUNT_APIKEY).append(tplId).append(mobile).append(content);
            /**
			 * 注意:发送短信返回1005错误码时,主要由于中文字符转码错误造成签名鉴权失败
			 * 在实际开发中采用采用UTF-8或者GB2312转码
			 * **/
			//String sign = md5Digest(changeCharset(signStr.toString(), "GB2312"));
			String sign = md5Digest(changeCharset(signStr.toString(), "UTF-8"));
			//创建HttpPost请求
			HttpPost httppost = new HttpPost(HttpUrl +"/sms/sendtplsms.json?sid="+ACCOUNT_SID+"&sign="+sign);
			//构建form
			List nvps = new ArrayList();
			nvps.add(new BasicNameValuePair("tplid", tplId));
			nvps.add(new BasicNameValuePair("mobile", mobile));
			nvps.add(new BasicNameValuePair("content", content));
			nvps.add(new BasicNameValuePair("extno", extno));
			UrlEncodedFormEntity entity = new UrlEncodedFormEntity(nvps,CHARSET_UTF8);
			httppost.setEntity(entity);
			
			//设置请求表头信息,POST请求必须采用application/x-www-form-urlencoded否则提示415错误
			httppost.setHeader("Content-Type", "application/x-www-form-urlencoded");
			httppost.setHeader("Content-Encoding", CHARSET_UTF8);
			//执行请求
			HttpResponse response = httpclient.execute(httppost);
			//获取响应Entity
			HttpEntity httpEntity = response.getEntity();
			//返回JSON字符串格式,用户根据实际业务进行解析处理
			if (httpEntity != null)
				resultJson = EntityUtils.toString(httpEntity, CHARSET_UTF8);
			
			EntityUtils.consume(entity);
		} catch (IOException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}  finally {
			if (httpclient != null)
				httpclient.getConnectionManager().shutdown();
		}
		System.out.println("resultJson=" +resultJson);
		return resultJson;
	}
	
	/**
	 * 查询账号信息
	 * 	/user/get.json?sid={sid}&sign={sign}
	 * @return json字符串,详细描述请参考接口文档 
	 * String
	 */
	public static String queryUser(){
		DefaultHttpClient httpclient = new DefaultHttpClient();
		String resultJson = "";
		try {
			//签名
			String sign = md5Digest(ACCOUNT_SID + ACCOUNT_APIKEY);
			//请求url
			StringBuilder url = new StringBuilder();
			url.append(HttpUrl).append("/user/get.json").append("?sid=").append(ACCOUNT_SID).append("&sign=").append(sign);
			//GET请求
			HttpGet httpget =  new HttpGet(url.toString());
			HttpResponse response = httpclient.execute(httpget);
			HttpEntity entity = response.getEntity();
			if (entity != null)
				resultJson = EntityUtils.toString(entity, CHARSET_UTF8);
			EntityUtils.consume(entity);
		} catch (IOException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}  finally {
			if (httpclient != null)
				httpclient.getConnectionManager().shutdown();
		}
		System.out.println("resultJson=" + resultJson);
		return resultJson;
	}
	
	/**
	 * 查询账号下所有模板信息
	 * @return json字符串,详细描述请参考接口文档 
	 * String
	 */
	public static String queryTpls(){
		DefaultHttpClient httpclient = new DefaultHttpClient();
		String resultJson = "";
		try {
			//签名
			String sign = md5Digest(ACCOUNT_SID + ACCOUNT_APIKEY);
			//请求url
			StringBuilder url = new StringBuilder();
			url.append(HttpUrl).append("/tpl/gets.json").append("?sid=").append(ACCOUNT_SID).append("&sign=").append(sign);
			//Http GET方式
			HttpGet httpget =  new HttpGet(url.toString());
			HttpResponse response = httpclient.execute(httpget);
			HttpEntity entity = response.getEntity();
			if (entity != null)
				resultJson = EntityUtils.toString(entity, CHARSET_UTF8);
			EntityUtils.consume(entity);
		} catch (IOException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}  finally {
			if (httpclient != null)
				httpclient.getConnectionManager().shutdown();
		}
		System.out.println("resultJson=" + resultJson);
		return resultJson;
	}
	/**
	 * 查询指定模板
	 * @param tplId 模板id
	 * @return json字符串,详细描述请参考接口文档 
	 * String
	 */
	public static String queryTplById(String tplId){
		DefaultHttpClient httpclient = new DefaultHttpClient();
		String resultJson = "";
		try {
			//签名
			String sign = md5Digest(ACCOUNT_SID + ACCOUNT_APIKEY + tplId);
			//
			StringBuilder url = new StringBuilder();
			url.append(HttpUrl).append("/tpl/get.json").append("?sid=").append(ACCOUNT_SID).append("&sign=").append(sign).append("&tplid=").append(tplId);
			//GET请求
			HttpGet httpget =  new HttpGet(url.toString());
			HttpResponse response = httpclient.execute(httpget);
			HttpEntity entity = response.getEntity();
			if (entity != null)
				resultJson = EntityUtils.toString(entity, CHARSET_UTF8);
			EntityUtils.consume(entity);
		} catch (IOException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}  finally {
			if (httpclient != null)
				httpclient.getConnectionManager().shutdown();
		}
		System.out.println("resultJson=" + resultJson);
		return resultJson;
	}
	
	/**
	 * 查询状态报告
	 * @return
	 * String
	 */
	public static String queryRpt(){
		DefaultHttpClient httpclient = new DefaultHttpClient();
		String resultJson = "";
		try {
			//签名
			String sign = md5Digest(ACCOUNT_SID + ACCOUNT_APIKEY);
			//请求url
			StringBuilder url = new StringBuilder();
			url.append(HttpUrl).append("/sms/queryrpt.json").append("?sid=").append(ACCOUNT_SID).append("&sign=").append(sign);
			//GET请求
			HttpGet httpget =  new HttpGet(url.toString());
			HttpResponse response = httpclient.execute(httpget);
			HttpEntity entity = response.getEntity();
			if (entity != null)
				resultJson = EntityUtils.toString(entity, CHARSET_UTF8);
			
			EntityUtils.consume(entity);
		} catch (IOException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}  finally {
			if (httpclient != null)
				httpclient.getConnectionManager().shutdown();
		}
		System.out.println("resultJson=" + resultJson);
		return resultJson;
	}
	
	
	/**
	 * 获取上行短信,采用GET方式
	 * /sms/querymo.json?sid={sid}&sign={sign}
	 * @return json字符串,详细描述请参考接口文档
	 * String
	 */
	public static String queryMo(){
		DefaultHttpClient httpclient = new DefaultHttpClient();
		String resultJson = "";
		try {
			//签名
			String sign = md5Digest(ACCOUNT_SID + ACCOUNT_APIKEY);
			//请求url
			StringBuilder url = new StringBuilder();
			url.append(HttpUrl).append("/sms/querymo.json").append("?sid=").append(ACCOUNT_SID).append("&sign=").append(sign);
			//GET请求
			HttpGet httpget =  new HttpGet(url.toString());
			HttpResponse response = httpclient.execute(httpget);
			HttpEntity entity = response.getEntity();
			if (entity != null)
				resultJson = EntityUtils.toString(entity, CHARSET_UTF8);
			EntityUtils.consume(entity);
		} catch (IOException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}  finally {
			if (httpclient != null)
				httpclient.getConnectionManager().shutdown();
		}
		System.out.println("resultJson=" + resultJson);
		return resultJson;
	}
	
	
	/**
	 * 校验黑名单,采用GET方式
	 * /assist/bl.json?sid={sid}&sign={sign}&mobile={mobile}
	 * @return json字符串,详细描述请参考接口文档
	 * String
	 */
	public static String validBL(String mobile){
		DefaultHttpClient httpclient = new DefaultHttpClient();
		String resultJson = "";
		try {
			//签名,MD5 32位
			String sign = md5Digest(ACCOUNT_SID + ACCOUNT_APIKEY);
			StringBuilder url = new StringBuilder();
			url.append(HttpUrl).append("/assist/bl.json")
			.append("?sid=").append(ACCOUNT_SID)
			.append("&sign=").append(sign)
			.append("&mobile=").append(mobile);
			//GET请求
			System.out.println(url.toString());
			HttpGet httpget =  new HttpGet(url.toString());
			HttpResponse response = httpclient.execute(httpget);
			HttpEntity entity = response.getEntity();
			if (entity != null)
				resultJson = EntityUtils.toString(entity, CHARSET_UTF8);
			EntityUtils.consume(entity);
		} catch (IOException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}  finally {
			if (httpclient != null)
				httpclient.getConnectionManager().shutdown();
		}
		System.out.println("resultJson=" + resultJson);
		return resultJson;
	}
	
	/**
	 * 校验敏感词,采用GET方式
	 * /assist/sw.json?sid={sid}& sign={sign}&content={content}
	 * @param content 内容
	 * @return json字符串,详细描述请参考接口文档
	 */
	public static String validSW(String content){
		DefaultHttpClient httpclient = new DefaultHttpClient();
		String resultJson = "";
		try {
			//签名
			String sign = md5Digest(ACCOUNT_SID + ACCOUNT_APIKEY);
			StringBuilder url = new StringBuilder();
			url.append(HttpUrl).append("/assist/sw.json")
				.append("?sid=").append(ACCOUNT_SID)
				.append("&sign=").append(sign)
				.append("&content=").append(content);
			//GET请求
			HttpGet httpget =  new HttpGet(url.toString());
			HttpResponse response = httpclient.execute(httpget);
			HttpEntity entity = response.getEntity();
			if (entity != null)
				resultJson = EntityUtils.toString(entity, CHARSET_UTF8);
			EntityUtils.consume(entity);
		} catch (IOException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}  finally {
			if (httpclient != null)
				httpclient.getConnectionManager().shutdown();
		}
		System.out.println("resultJson=" + resultJson);
		return resultJson;
	}
	
	
	/**
	 * MD5算法
	 * @param src 
	 * @return
	 * @throws NoSuchAlgorithmException
	 * @throws UnsupportedEncodingException
	 * String
	 */
	public static String md5Digest(String src) throws NoSuchAlgorithmException, UnsupportedEncodingException{
		MessageDigest md = MessageDigest.getInstance("MD5");
		byte[] b = md.digest(src.getBytes(CHARSET_UTF8));
		return byte2HexStr(b);
	}
	private static String byte2HexStr(byte[] b){
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < b.length; ++i) {
			String s = Integer.toHexString(b[i] & 0xFF);
			if (s.length() == 1)
				sb.append("0");
			sb.append(s.toUpperCase());
		}
		return sb.toString();
	}
	
	/**
	 * 字符编码转换
	 * @param str
	 * @param newCharset
	 * @return
	 * @throws UnsupportedEncodingException
	 * String
	 */
	public static String changeCharset(String str, String newCharset)
			throws UnsupportedEncodingException {
		if (str != null) {
			//用默认字符编码解码字符串。
			byte[] bs = str.getBytes(newCharset);
			//用新的字符编码生成字符串
			return new String(bs, newCharset);
		}
		return null;
	}
}

4.2 C#示例

下载demo源代码 下载开发文档
 
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
/// 
/// 1、此类可以直接使用,使用前请配置相关的参数,参数从会员中心获取,如有疑问请咨询美圣(http://www.rcscloud.com)客服人员
/// 2、考虑适用性,本例基于.NET FRAMEWORK 2.0,开发者可以根据情况选择更高版本的.NET FRAMEWORK
/// 
public class RCSCloudRestAPI
{
    public RCSCloudRestAPI(){}
    ///
    /// 接口服务器IP地址
    ///
    private const String SERVER_IP = "IP";
    ///
    /// 接口服务器端口
    ///
    private const String SERVER_PORT = "端口";
    /// 
    /// 账号(从会员中心获取)
    /// 
    private const string ACCOUNT_SID = "";
    /// 
    /// APIKEY(从会员中心帐号列表中获取,APIKEY可以自主在会员中心更新)
    /// 
    private const string ACCOUNT_APIKEY = "";
 
    /// 
    /// 发送模板短信
    /// 
    /// 
    /// 手机号码
    /// 短信内容
    /// 扩展码(从会员中心帐号列表中获取)
    /// 
    public static String sendTplSms(String templateId, String mobile, String content, String extno)
    {
        String resultJson = "";
        try
        {
            //请求头部设置认证信息
            string src = string.Format("{0}{1}{2}{3}{4}", ACCOUNT_SID, ACCOUNT_APIKEY, templateId, mobile, content);
            string sign = Tool.GetMD5(src);
            //短信发送的相关参数
            StringBuilder dic = new StringBuilder();
            dic.AppendFormat("&sid={0}", ACCOUNT_SID);
            dic.AppendFormat("&sign={0}", sign);
            dic.AppendFormat("&tplid={0}", templateId);
            dic.AppendFormat("&mobile={0}", mobile);
            dic.AppendFormat("&content={0}", content);
            dic.AppendFormat("&extno={0}", extno);
            //构建请求URL,所有url都必须包含sign、sid参数
            string url = string.Format("http://{0}:{1}/rcsapi/rest/sms/sendtplsms.json", SERVER_IP, SERVER_PORT);
            resultJson =   Tool.SendHttpPost(url.ToString(), dic.ToString());
        }
        catch (Exception e)
        {
            //异常处理
        }
        return resultJson;
    }
    /// 
    /// 查询账号信息  GET 请求
    /// 
    /// 
    public static String queryUser()
    {
        String resultJson = "";
        try
        {
            //构建请求URL,所有url都必须包含sign、sid参数
            //请求头部设置认证信息
            string src = string.Format("{0}{1}", ACCOUNT_SID, ACCOUNT_APIKEY);
            string sign = Tool.GetMD5(src);
            string url = GetBaseUrl("user/get.json", sign);
            return Tool.HttpGet(url);
        }
        catch (Exception e)
        {
            //异常处理
        }
        return resultJson;
    }
    /// 
    /// 查询账号下所有模板信息
    /// 
    /// return json字符串,详细描述请参考接口文档 
    public static String queryTpls()
    {
        String resultJson = "";
        try
        {
            //构建请求URL,所有url都必须包含sign、sid参数
            //请求头部设置认证信息
            string src = string.Format("{0}{1}", ACCOUNT_SID, ACCOUNT_APIKEY);
            string sign = Tool.GetMD5(src);
            string url = GetBaseUrl("tpl/gets.json", sign);
            return Tool.HttpGet(url);
        }
        catch (Exception e)
        {
            //异常处理
        }
        return resultJson;
    }
    /// 
    /// 根据模板ID查询模板信息
    /// 
    /// 
    /// 
    public static String queryTemplate(string tplId)
    {
        string resultJson = "";
        try
        {
            //构建请求URL,所有url都必须包含sign、sid参数
            //请求头部设置认证信息
            string src = string.Format("{0}{1}{2}", ACCOUNT_SID, ACCOUNT_APIKEY,tplId);
            string sign = Tool.GetMD5(src);
            string url = GetBaseUrl("tpl/get.json", sign);
            url = string.Format("{0}&tplid={1}", url, tplId);
            return Tool.HttpGet(url);
        }
        catch (Exception e)
        {
            //异常处理
        }
        return resultJson;
    }
    /// 
    /// 获取上行短信,采用GET方式
    /// 
    /// return json字符串,详细描述请参考接口文档 
    public static String queryMo()
    {
        String resultJson = "";
        try
        {
            //构建请求URL,所有url都必须包含sign、sid参数
            //请求头部设置认证信息
            string src = string.Format("{0}{1}", ACCOUNT_SID, ACCOUNT_APIKEY);
            string sign = Tool.GetMD5(src);
            string url = GetBaseUrl("sms/querymo.json", sign);
            return Tool.HttpGet(url);
        }
        catch (Exception e)
        {
            //异常处理
        }
        return resultJson;
    }
    /// 
    ///  校验黑名单,采用GET方式
    /// 
    /// 
    /// 
    public static String validBL(string mobile)
    {
        string resultJson = "";
        try
        {
            //构建请求URL,所有url都必须包含sign、sid参数
            //请求头部设置认证信息
            string src = string.Format("{0}{1}", ACCOUNT_SID, ACCOUNT_APIKEY);
            string sign = Tool.GetMD5(src);
            string url = GetBaseUrl("assist/bl.json", sign);
            url = string.Format("{0}&mobile={1}", url,mobile );
            return Tool.HttpGet(url);
        }
        catch (Exception e)
        {
            //异常处理
        }
        return resultJson;
    }
    /**
	 * 校验敏感词,采用GET方式
	 * /assist/sw.json?sid={sid}& sign={sign}&content={content}
	 * @param content 内容
	 * @return json字符串,详细描述请参考接口文档
	 */
    public static String validSW(String content)
    {
        String resultJson = "";
        try
        {
            //构建请求URL,所有url都必须包含sign、sid参数
            //请求头部设置认证信息
            string src = string.Format("{0}{1}", ACCOUNT_SID, ACCOUNT_APIKEY);
            string sign = Tool.GetMD5(src);
            string url = GetBaseUrl("assist/sw.json", sign);
            url = string.Format("{0}&content={1}", url, content);
            return Tool.HttpGet(url);
        }
        catch (Exception e)
        {
            //异常处理
        }
        return resultJson;
    }
    /// 
    /// 查询状态报告
    /// 
    /// 
    public static String queryRpt()
    {
        String resultJson = "";
        try
        {
            //构建请求URL,所有url都必须包含sign、sid参数
            //请求头部设置认证信息
            string src = string.Format("{0}{1}", ACCOUNT_SID, ACCOUNT_APIKEY);
            string sign = Tool.GetMD5(src);
            string url = GetBaseUrl("sms/queryrpt.json", sign);
            return Tool.HttpGet(url);
        }
        catch (Exception e)
        {
            //异常处理
        }
        return resultJson;
    }
    #region 辅助方法
    /// 
    /// 组合接口URL
    /// 
    /// 接口动作
    /// 时间标记
    /// 接口类别:标记是测试环境与正式环境的接口
    /// 
    private static string GetBaseUrl(string action, string sign)
    {
        //按照SID/TOKEN/TS顺序进行MD5加密
       // String sign = string.Format("{0}{1}{2}", ACCOUNT_SID, ACCOUNT_APIKEY, timestamp);
       // String signature = Tool.GetMD5(sign);
        string url = string.Format("http://{0}:{1}/rcsapi/rest/{2}?sid={3}&sign={4}", SERVER_IP, SERVER_PORT, action, ACCOUNT_SID, sign);
       
        return url;
    } 
    #endregion
}
 
    

PHP示例

下载demo源代码 下载开发文档
        
        /**
        * 美圣代理平台 Http Demo for PHP
        * 参考开发帮助文档 http://www.xx.cn/common/api
        *
        * DEMO提供以下功能示例。请将参数设置成您账号的参数,并去掉相应功能的注释,即可进行测试。
        * 1、账号接口 信息获取
        * 2、查询账号所有模板
        * 3、查询单个模板
        * 4、模板短信接口
        * 5、状态接口 信息获取
        * 6、上行接口 信息获取
        * 7、检测黑名单
        * 8、检测敏感词
        *
        */
        // 函数定义
        include_once("phpdemo_func.php");
        //参数设置
        $sid      = "ZH00000xxxx";                               // 短信账号
        $apikey   = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";      // APIKEY
        $svr_rest = "http://IP:Port/rcsapi/rest";    // rest请求地址
        $mobile   = "138xxxxxxxx";                               // 需要测试的手机号
        $tplid    = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";          // 测试发送的模板id
        // *** 1、账号接口 信息获取
        /*
        $sign     = md5($sid.$apikey);                                       // 签名认证 Md5(sid+apikey)
        $svr_url  = $svr_rest."/user/get.json?sid=".$sid."&sign=".$sign;     // 服务器接口路径
        $json_arr = json_decode(file_get_contents($svr_url));                // 获取信息
        my_print_arr($json_arr,"账号接口:");                                // 输出
        */
        // *** 2、查询账号所有模板
        /*
        $sign     = md5($sid.$apikey);                                       // 签名认证 Md5(sid+apikey)
        $svr_url  = $svr_rest."/tpl/gets.json?sid=".$sid."&sign=".$sign;     // 服务器接口路径
        $json_arr = json_decode(file_get_contents($svr_url));                // 获取信息
        my_print_arr($json_arr,"查询账号所有模板:");                        // 输出
        */
        // *** 3、查询单个模板
        /*
        //  $tplid    = "69af1cbbb95043478593767935bc6c51";                      // 模板id
        $sign     = md5($sid.$apikey.$tplid);                                // 签名认证 Md5(sid+apikey+tplid)
        $svr_url  = $svr_rest."/tpl/get.json?sid=".$sid."&sign=".$sign."&tplid=".$tplid;    // 服务器接口路径
        $json_arr = json_decode(file_get_contents($svr_url));                // 获取信息
        my_print_arr($json_arr,"查询单个模板:");                            // 输出
        */
        // *** 4、模板短信接口
        /*
        //  $tplid    = "69af1cbbb95043478593767935bc6c51";                      // 模板id
        $content  = "@1@=".rand(100000,999999);                              // 参数值,多个参数以“||”隔开 如:@1@=HY001||@2@=3281
        $sign     = md5($sid.$apikey.$tplid.$mobile.$content);               // 签名认证 Md5(sid+apikey+tplid+mobile+content)
        $svr_url  = $svr_rest."/sms/sendtplsms.json";                        // 服务器接口路径
        // POST方式提交服务器
        $post_data = array();
        $post_data["sign"]      = $sign;
        $post_data["sid"]       = $sid;
        $post_data["tplid"]     = $tplid;
        $post_data["mobile"]    = $mobile;
        $post_data["content"]   = $content;
        $json_arr = json_decode(request_post($svr_url, $post_data));
        my_print_arr($json_arr,"模板短信发送:");                            // 输出
        */
        // *** 5、状态接口 信息获取
        /*
        $sign     = md5($sid.$apikey);                                          // 签名认证 Md5(sid+apikey)
        $svr_url  = $svr_rest."/sms/queryrpt.json?sid=".$sid."&sign=".$sign;    // 服务器接口路径
        $json_arr = json_decode(file_get_contents($svr_url));                   // 获取信息
        my_print_arr($json_arr,"状态接口:");                                   // 输出
        */
        // *** 6、上行接口 信息获取
        /*
        $sign     = md5($sid.$apikey);                                          // 签名认证 Md5(sid+apikey)
        $svr_url  = $svr_rest."/sms/querymo.json?sid=".$sid."&sign=".$sign;     // 服务器接口路径
        $json_arr = json_decode(file_get_contents($svr_url));                   // 获取信息
        my_print_arr($json_arr,"上行接口:");                                   // 输出
        */
        // *** 7、检测黑名单
        /*
        $sign     = md5($sid.$apikey);                                          // 签名认证 Md5(sid+apikey)
        $svr_url  = $svr_rest."/assist/bl.json?sid=".$sid."&sign=".$sign."&mobile=".$mobile;     // 服务器接口路径
        $json_arr = json_decode(file_get_contents($svr_url));                   // 获取信息
        my_print_arr($json_arr,"检测黑名单:");                                 // 输出
        */
        // *** 8、检测敏感词
        /*
        $content  = urlencode("枪支,法轮功");                                   // 多个敏感词以逗号隔开
        $sign     = md5($sid.$apikey);                                          // 签名认证 Md5(sid+apikey)
        $svr_url  = $svr_rest."/assist/sw.json?sid=".$sid."&sign=".$sign."&content=".$content;     // 服务器接口路径
        $json_arr = json_decode(file_get_contents($svr_url));                   // 获取信息
        my_print_arr($json_arr,"检测敏感词:");                                 // 输出
        */
 

江苏南京雨花台区软件大道119号丰盛商汇5幢512

025-52620989 ©江苏美圣信息技术有限公司 苏ICP备12013377号-6