您的位置:首页 >  接口中心 > 365bet官网网址是多少接口DEMO-SHELL
  365bet官网网址是多少接口DEMO-SHELL
 

云通讯平台-SHELL365bet官网网址是多少接口开发示例


#!/bin/sh

# account and password can be change to what you wanna!

#author Yuntongxun

#修改为您的account

account=""

#修改为您的pw

password="a.123456"

#修改为您要发送的手机号

phone="18712345678"

#设置您要发送的内容

msg="【云通讯】您的验证码是123456。如非本人操作,请忽略。"

echo "send sms:"


#请求地址请登录云通讯自助通平台查看或者询问您的商务负责人获取

url="https://u.smsyun.cc/sms-partner/access/{用户帐号}/sendsms"

data="{"account":"$account","password":"$password","phone":"$phone","msg":"$msg","report":"true"}"

curl -H "Content-Type:application/json" -X POST --data $data $url



C# Post.cs


using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.IO;

using System.Net;

using System.Text;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using System.Security.Cryptography.X509Certificates;

using System.Net.Security;


public partial class Post : System.Web.UI.Page

{

    public static string PostUrl = ConfigurationManager.AppSettings["WebReference.Service.PostUrl"];

    protected void Page_Load(object sender, EventArgs e)

    {


    }

    protected void ButSubmit_Click(object sender, EventArgs e)

    {

        string un = this.Txtaccount.Text.Trim();

        string pw = this.Txtpassword.Text.Trim();

        string phone = this.Txtmobile.Text.Trim();

        string content = "【云通讯】" + HttpContext.Current.Server.UrlEncode(this.Txtcontent.Text.Trim());



        string postJsonTpl = ""account":"{0}","password":"{1}","phone":"{2}","report":"false","msg":"{3}"";

        string jsonBody = string.Format(postJsonTpl, un, pw, phone, content);

        string result = doPostMethodToObj("https://u.smsyun.cc/sms-partner/access/{用户帐号}/sendsms", "{" + jsonBody + "}");//请求地址请登录云通讯平台查看或者询问您的商务负责人获取

        LabelRetMsg.Text = result;


    }


    public static string doPostMethodToObj(string url, string jsonBody)

    {

        string result = String.Empty;

        HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url);

        httpWebRequest.ContentType = "application/json";

        httpWebRequest.Method = "POST";


        // Create NetworkCredential Object 

        NetworkCredential admin_auth = new NetworkCredential("username", "password");


        // Set your HTTP credentials in your request header

        httpWebRequest.Credentials = admin_auth;


        // callback for handling server certificates

        ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };


        using (StreamWriter streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))

        {

            streamWriter.Write(jsonBody);

            streamWriter.Flush();

            streamWriter.Close();

            HttpWebResponse httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();

            using (StreamReader streamReader = new StreamReader(httpResponse.GetResponseStream()))

            {

                result = streamReader.ReadToEnd();

            }

        }

        return result;

    }


}