รบกวนช่วยผู้รู้ทุกท่านช่วยแปลง Code นี้เป็น VB6 ให้ด้วยครับ ขอบคุณล่วงหน้าครับ
Private void button1_Click(object sender, System.EventArgs e) { string strData; string strURL; string strResult; string szLanguage = "E"; string szUsername ="username"; string szPassword ="password";
strData = "msisdn="+this.textBox1.Text+"&user="+szUsername+"&pass=" +szPassword+"&lang="+szLanguage+"&msg="+this.textBox1.Text; strURL = "http://smsgateway.applymail.com/cgi-bin/aspsendsms.cgi";
System.Net.WebRequest req = System.Net.WebRequest.Create(strURL); req.ContentType = "application/x-www-form-urlencoded"; req.Method = "POST"; byte [] bytes = System.Text.Encoding.ASCII.GetBytes(strData); req.ContentLength = bytes.Length; System.IO.Stream os = req.GetRequestStream (); os.Write (bytes, 0, bytes.Length); os.Close (); System.Net.WebResponse resp = req.GetResponse();
System.IO.StreamReader sr = new System.IO.StreamReader(resp.GetResponseStream()); strResult = sr.ReadToEnd().Trim();
strResult = strResult.Substring(strResult.IndexOf("")+8,strResult.IndexOf("")-strResult.IndexOf("")-8 ); if(strResult=="OK") { MessageBox.Show("Send SMS Complete"); }else{ MessageBox.Show("Error to Send"); } }
|