SMS service to send Message to a URL

Here is the sample code for same , I used it for implementing SMS service in project that sends message to particular URL which in turn sends SMS to particualr phone number,

using System.Net;

using System.Xml;

XmlDocument xDoc = new XmlDocument();

//xDoc = ; //some xml data

Byte[] outputbyte;

string sXML = “”;

string strResult = “”;

String URL = “http://someurl.com/”;//url that

Byte[] inputbyte = System.Text.Encoding.ASCII.GetBytes(xDoc.OuterXml);

WebClient wc = new WebClient();

wc.Headers.Add(“Content-Type”, “text/xml”);

outputbyte = wc.UploadData(URL, inputbyte);//will upload a byte of data to specific url service

sXML = System.Text.Encoding.ASCII.GetString(outputbyte);

System.Xml.XmlDocument xmlData = new System.Xml.XmlDocument();

xmlData.LoadXml(sXML); // will load whole xml and now you can traverse to any xml node.


Bookmark and Share