HTTP SEND C#
C# Code Example - Sending SMS <%@ Import Namespace=”System.Net”%> <%@ Import Namespace=”System.IO”%> <%@ Import Namespace=”System.Web”%> <script language=”C#” runat=”server”> void Page_Load(Object Src, EventArgs E) { myPage.Text = readHtmlPage(“https://api.sendmode.com/httppost.aspx”); } private String readHtmlPage(string url) { String result = “”; String message = HttpUtility.UrlEncode(“Hello world!”); String strPost = “username=yourusername&password=yourpass&data1=” + message + “&numto=44712345678″ strPost += “&senderid=TEST&type=sendparam”; StreamWriter myWriter = null; HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url); objRequest.ContentLength = Encoding.UTF8.GetByteCount(strPost); objRequest.ContentType = “application/x-www-form-urlencoded”; try{ myWriter = new StreamWriter(objRequest.GetRequestStream()); myWriter.Write(strPost); } catch (Exception e) { return e.Message; } finally { myWriter.Close(); } HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse(); using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()) ) { result = sr.ReadToEnd(); // Close and clean up the StreamReader sr.Close(); } return result; } </>