Click here to Skip to main content
15,891,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using the following script for sending sms through our website, but it does not work. The sms is not sent. So can anyone help me to solve this problem?
Label sms = new Label();
       sms.Text = "Your Login Id is " + user_id + " and password is " + pass;
       string strUrl = "http://www.way2sms.com?user=user_id:pass&senderID=e&receipientno=9001233211&msgtxt= " + sms  ;
       WebRequest request = HttpWebRequest.Create(strUrl);
       HttpWebResponse response = (HttpWebResponse)request.GetResponse();
       Stream s = (Stream)response.GetResponseStream();
       StreamReader readStream = new StreamReader(s);
       string dataString = readStream.ReadToEnd();
       response.Close();
       s.Close();
       readStream.Close();
       dbcon.closecon();
        try
       {
           //Create the request and send data to Ozeki NG SMS Gateway Server by HTTP connection
           HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(strUrl);
           //Get response from Ozeki NG SMS Gateway Server and read the answer
           HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse();
           System.IO.StreamReader respStreamReader = new System.IO.StreamReader(myResp.GetResponseStream());
           string responseString = respStreamReader.ReadToEnd();
           respStreamReader.Close();
           myResp.Close();
           //inform the user
           //lblMessage.Visible = true;
           //lblMessage.Text = "Sent Successfully";
           //textboxError.Visible = true;
       }
       catch (Exception ex)
       {
           //if sending request or getting response is not successful, Ozeki NG - SMS Gateway Server may not be running
           //lblMessage.Visible = true;
           //lblMessage.Text = " SMS Gateway Server is not running!" + "<br/>" + createdURL + ex.Message;
           //textboxError.Visible = true;
       }
Posted
Updated 18-Feb-11 15:07pm
v5
Comments
Sandeep Mewara 18-Feb-11 1:25am    
Couldn't work == any error?
Abdul Quader Mamun 18-Feb-11 21:07pm    
Edited spelling.

1 solution

Having looked over it there is no obvious problem.
It may be how you are calling it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900