C # SMS Interface code implementation (texting)

Source: Internet
Author: User
Tags urlencode

I am here with 56 SMS interface for example!

  1. First need to 56 SMS online to register an account, the code needs to use 4 parameters: Enterprise ID, user name, password, the platform used

  2. In the inside to fill the money with the following code can send text messages!

    public void Send (string orderids, String Mobile, String productName)
    {

    Tel: is the mobile number you want to send

    Msg: What to send
    Send SMS
    String cid = "1345";//Enterprise number ID
    String username = "test15";//user name
    String userpwd = "test15333";//Password
    String mssage = "Order submitted successfully!";
    String _sms = "10690";//Platform
    String msg = "Your order has been submitted successfully!" + "Order Number: (" + orderids + ") Product Name:" + ProductName + "" Company Name "";
    msg = Httputility.urlencode (msg, System.Text.Encoding.GetEncoding ("GBK"));//Because the site is UTF-8 encoding, to do a bit of transcoding, otherwise it will be garbled, Call the webs without transcoding
    string Tel = mobile;
    String url = "Http://jiekou.56dxw.com/sms/HttpInterface.aspx?comid=" + cid + "&username=" + username + "&userpwd= "+ userpwd +" &handtel= "+ Tel +" &sendcontent= "+ msg +" &sendtime=&smsnumber= "+ _sms +" ";
    WebRequest wrequest = webrequest.create (URL);
    WebResponse wresponse = Wrequest.getresponse ();
    Stream stream = Wresponse.getresponsestream ();
    StreamReader reader = new StreamReader (stream, System.Text.Encoding.Default);
    String r = Reader. ReadToEnd ();
    Wresponse.close ();

    ScriptUtil.Instance.Alert (Mssage);
    }

Extended reading:

Guide: we only provide ASP. 56 SMS Interface core code, for different sites, systems, can make corresponding changes. This interface can only send one mobile phone number at a time, such as need to send multiple, can loop, or call httpinterfacemore.aspx and WebService file interface, this source code only applies to 56 SMS interface, the other is not the development of the company interface, there are problems, We don't do technical support.




We only provide the core code, for the wrong platform, can make corresponding changes.
This interface can only send one phone number at a time, such as need to send multiple times, can loop, or call httpinterfacemore.aspx and WebService file interface

If the content is garbled, please encode it, such as:

String message = "People's Republic of China";
Message = Httputility.urlencode (message, System.Text.Encoding.GetEncoding ("GB2312"));

You need to reference the name of the namespace:

Using System.Text;
Using System.IO;
Using System.Net;

The code is as follows:

public string Httpinterface ()
{
String url= "http://jiekou.56dxw.com/sms/HttpInterface.aspx?comid= Enterprise id&username= username &userpwd= Password & Handtel= Mobile phone Number

&sendcontent= Content limited to 70 characters &sendtime= time &smsnumber= the platform "

WebRequest wrequest = webrequest.create (URL);
WebResponse wresponse = Wrequest.getresponse ();
Stream stream = Wresponse.getresponsestream ();
StreamReader reader = new StreamReader (stream, System.Text.Encoding.Default);
String r = Reader. ReadToEnd ();
Wresponse.close ();

}

For more details, please read the website: http://www.56dxw.com/Interface/150.html

This article is from the "Program Ape" blog, please be sure to keep this source http://haihuiwei.blog.51cto.com/4789207/1586627

C # SMS Interface code implementation (texting)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.