These days, the results of Baidu, summed up an example: a website to provide send SMS interface business interface: Service_url variable parameter: username,pwd,mobiles,content return: <returninfo>resultcode </ReturnInfo>
1. Build the sent XML or other form of the request string postdata = string. Format ("Actioncode=sms01&username=mine&pwd=123&mobiles={0}&content={1}", StrMobiles, strMessage+ "Customer Service Center" ");and convert the request into byte formatbyte[] data = Encoding.Default.GetBytes (PostData), 2, with HttpWebRequest to send the establishment request HttpWebRequest Myrequest = (HttpWebRequest ) WebRequest.Create (Service_url);3, write to the request related properties of the request, that is, the requested header format (Request method, version type, the requested character encoding, response time, etc.)Myrequest. Method = "POST"; Myrequest. ContentType = "application/x-www-form-urlencoded"; Myrequest. ContentLength = data. Length;4, writes request information to the request using (Stream Datasteam = myrequest. GetRequestStream ()) {Datasteam. Write (data, 0, data. Length); Datasteam. Close (); }5. Get Response Request httpwebresponse myresponse = myrequest. GetResponse () as httpwebresponse;6, reading data from the response HttpWebResponse myResponse = Myrequest. GetResponse () as HttpWebResponse; using (Streamreader reader = new streamreader ( myresponse.getresponsestream () ,&nbSp System.Text.Encoding.GetEncoding ("Utf-8")) { Response = reader. ReadToEnd (); Xmldoc.loadxml (response); reader. Close (); The general return from the Web site is a string of XML format 7, the string is converted to XML format, and take out the relevant data xmldocument xmldoc = new system.xml.xmldocument (); string result = Xmldoc.selectsinglenode ("Returninfo"). InnerText;