how to pass the textbox value as parameter in url
-
hello sir, i got an api for sending sms.i am implemneting it in my software.the hosting company has sent me the url and some codes.when pasting the url in my browser followed by my mobile no and message.then i am able to get the sms.but i have designed a windows form which contains 2 textboxes such as for mobile no and message respectively.and a send button.i want the mobile no and message from textboxes will pass as parameters in the url.how will i pass this value?please help my,its urgent. i am posting details of my code: ---------------------------------- private static string CALLURL(string url) { string Res = ""; try { HttpWebRequest gatewayReq; //Used for HTTP Request HttpWebResponse gatewayRes; //Used for HTTP Response gatewayReq = (HttpWebRequest)WebRequest.Create(url); gatewayReq.Timeout = 60000; gatewayReq.Method = "GET"; gatewayRes = (HttpWebResponse)gatewayReq.GetResponse(); Stream ReceiveStream = gatewayRes.GetResponseStream(); StreamReader sr = new StreamReader(ReceiveStream);//, System.Text.Encoding.ASCII); Res = sr.ReadToEnd(); MessageBox.Show("message sent successfully."); } catch { //Res = "URL is not responding at the moment."; //WriteErrorLog(DateTime.Now + "|" + "Call URL Function: " + ex.Message.ToString()); MessageBox.Show("Sorry,Unable to send Sms.Try Again Later."); } return Res; } private void send_Click(object sender, EventArgs e) { string url; string msg; Int64 no; no = Convert.ToInt64(textBox1.Text); msg = textBox2.Text; url = "http://203.212.64.15/genericpushnew/pushsms.aspx?userid=demo123&password=hotmail01&masking=CVRTNP&mobileno=no&message=msg"; CALLURL(url); } }
-
hello sir, i got an api for sending sms.i am implemneting it in my software.the hosting company has sent me the url and some codes.when pasting the url in my browser followed by my mobile no and message.then i am able to get the sms.but i have designed a windows form which contains 2 textboxes such as for mobile no and message respectively.and a send button.i want the mobile no and message from textboxes will pass as parameters in the url.how will i pass this value?please help my,its urgent. i am posting details of my code: ---------------------------------- private static string CALLURL(string url) { string Res = ""; try { HttpWebRequest gatewayReq; //Used for HTTP Request HttpWebResponse gatewayRes; //Used for HTTP Response gatewayReq = (HttpWebRequest)WebRequest.Create(url); gatewayReq.Timeout = 60000; gatewayReq.Method = "GET"; gatewayRes = (HttpWebResponse)gatewayReq.GetResponse(); Stream ReceiveStream = gatewayRes.GetResponseStream(); StreamReader sr = new StreamReader(ReceiveStream);//, System.Text.Encoding.ASCII); Res = sr.ReadToEnd(); MessageBox.Show("message sent successfully."); } catch { //Res = "URL is not responding at the moment."; //WriteErrorLog(DateTime.Now + "|" + "Call URL Function: " + ex.Message.ToString()); MessageBox.Show("Sorry,Unable to send Sms.Try Again Later."); } return Res; } private void send_Click(object sender, EventArgs e) { string url; string msg; Int64 no; no = Convert.ToInt64(textBox1.Text); msg = textBox2.Text; url = "http://203.212.64.15/genericpushnew/pushsms.aspx?userid=demo123&password=hotmail01&masking=CVRTNP&mobileno=no&message=msg"; CALLURL(url); } }
url = "http://203.212.64.15/...... change it to : StringBuilder sb = new StringBuilder(); sb.Append("http://203.212.64.15/genericpushnew/pushsms.aspx?userid=demo123&password=hotmail01&masking=CVRTNP&mobileno="); sb.Append(textBoxNumber.Text); sb.Append(&message=); sb.Append(textBoxMessage.Text); url = sb.ToString();
-
hello sir, i got an api for sending sms.i am implemneting it in my software.the hosting company has sent me the url and some codes.when pasting the url in my browser followed by my mobile no and message.then i am able to get the sms.but i have designed a windows form which contains 2 textboxes such as for mobile no and message respectively.and a send button.i want the mobile no and message from textboxes will pass as parameters in the url.how will i pass this value?please help my,its urgent. i am posting details of my code: ---------------------------------- private static string CALLURL(string url) { string Res = ""; try { HttpWebRequest gatewayReq; //Used for HTTP Request HttpWebResponse gatewayRes; //Used for HTTP Response gatewayReq = (HttpWebRequest)WebRequest.Create(url); gatewayReq.Timeout = 60000; gatewayReq.Method = "GET"; gatewayRes = (HttpWebResponse)gatewayReq.GetResponse(); Stream ReceiveStream = gatewayRes.GetResponseStream(); StreamReader sr = new StreamReader(ReceiveStream);//, System.Text.Encoding.ASCII); Res = sr.ReadToEnd(); MessageBox.Show("message sent successfully."); } catch { //Res = "URL is not responding at the moment."; //WriteErrorLog(DateTime.Now + "|" + "Call URL Function: " + ex.Message.ToString()); MessageBox.Show("Sorry,Unable to send Sms.Try Again Later."); } return Res; } private void send_Click(object sender, EventArgs e) { string url; string msg; Int64 no; no = Convert.ToInt64(textBox1.Text); msg = textBox2.Text; url = "http://203.212.64.15/genericpushnew/pushsms.aspx?userid=demo123&password=hotmail01&masking=CVRTNP&mobileno=no&message=msg"; CALLURL(url); } }
Use this:
url = string.Format("http://203.212.64.15/genericpushnew/pushsms.aspx?userid=demo123&password=hotmail01&masking=CVRTNP&mobileno={0}&message={1}",
Convert.ToInt64(textBox1.Text), textBox2.Text); -
hello sir, i got an api for sending sms.i am implemneting it in my software.the hosting company has sent me the url and some codes.when pasting the url in my browser followed by my mobile no and message.then i am able to get the sms.but i have designed a windows form which contains 2 textboxes such as for mobile no and message respectively.and a send button.i want the mobile no and message from textboxes will pass as parameters in the url.how will i pass this value?please help my,its urgent. i am posting details of my code: ---------------------------------- private static string CALLURL(string url) { string Res = ""; try { HttpWebRequest gatewayReq; //Used for HTTP Request HttpWebResponse gatewayRes; //Used for HTTP Response gatewayReq = (HttpWebRequest)WebRequest.Create(url); gatewayReq.Timeout = 60000; gatewayReq.Method = "GET"; gatewayRes = (HttpWebResponse)gatewayReq.GetResponse(); Stream ReceiveStream = gatewayRes.GetResponseStream(); StreamReader sr = new StreamReader(ReceiveStream);//, System.Text.Encoding.ASCII); Res = sr.ReadToEnd(); MessageBox.Show("message sent successfully."); } catch { //Res = "URL is not responding at the moment."; //WriteErrorLog(DateTime.Now + "|" + "Call URL Function: " + ex.Message.ToString()); MessageBox.Show("Sorry,Unable to send Sms.Try Again Later."); } return Res; } private void send_Click(object sender, EventArgs e) { string url; string msg; Int64 no; no = Convert.ToInt64(textBox1.Text); msg = textBox2.Text; url = "http://203.212.64.15/genericpushnew/pushsms.aspx?userid=demo123&password=hotmail01&masking=CVRTNP&mobileno=no&message=msg"; CALLURL(url); } }
well its quite easy but ur calling the functions in a wrong way.... We did the same project in VB,C# as well as asp.net successfully. 9870187165