1800 87 7061 (Malaysia Toll Free) +603 2780 3880 (KL)
How to Send SMS With C#This guide is a guide provided by our iSMS Team. You will be given information on how to add SMS functionality to your website and how to send sms with C# code. This method uses HTTP communication between the SMS Gateway and your website. To send and receive SMS messages from a webpage, you will need to have scripting support enabled on your webserver. Below are some examples using C# scripting. To understand more about our iSMS API Key features, please visit our Developer API page. All available features and configurations will be displayed at the iSMS Developer API page. Integrate our SMS API into your C# application and enjoy our SMS services. Download C# Demo Scripts Please click below to find out about other programming language samples. 1. Firstly, register a username and password from iSMS Register Page. It only requires a few information from you such as username, password and your mobile number. It is free. After you have register an account, you will need to purchase some credit from iSMS Reload Page, you will receive an email containing the reload PIN if you purchase for the first time. However, if you purchase more than once, the account is automatically credited. Login to iSMS website and insert the PIN. 2. Now you are ready.
using System;
using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.IO; using System.Web; using System.Net; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { String message = HttpUtility.UrlEncode("Hello world!"); SendSMSToURL("http://www.isms.com.my/isms_send.php?un=username&pwd=password&dstno=60123456789&msg=" + message + "&type=1&sendid=12345"); } private string SendSMSToURL(string getUri) { string SentResult = String.Empty; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(getUri); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); StreamReader responseReader = new StreamReader(response.GetResponseStream()); String resultmsg = responseReader.ReadToEnd(); responseReader.Close(); int StartIndex = 0; int LastIndex = resultmsg.Length; if (LastIndex > 0) SentResult = resultmsg.Substring(StartIndex, LastIndex); responseReader.Dispose(); return SentResult; } } } Download C# Demo Scripts Contact UsPlease contact us HERE, if you have any enquiries or looking for any consultation. Email: sales@mobiweb.com.my Note to registered users: Please include your Username in the email. Phone Numbers:
Fax:
|