Click here to Skip to main content
15,907,906 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
void sendmsg()
{
    string strUrl = "http://api.mVaayoo.com/mvaayooapi/MessageCompose?user=t122kes@gmail.com:9768214005&senderID=TESTSMS&receipientno=+919768214005&msgtxt=faisalshaikh&state=4";
    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();
}


i want to put the recepients number and text from a textbox.
how should i do that ?
Posted
v2

Try below code

C#
string strUrl = "http://api.mVaayoo.com/mvaayooapi/MessageCompose?user=t122kes@gmail.com:9768214005&senderID=TESTSMS&receipientno={0}&msgtxt={1}&state=4";
strUrl = string.Format(strUrl,txtNumber.Text, txtMessage.Text);

//Here txtNumber is Textbox which contains number and txtMessage contains message text



Now you can use strUrl in you code with updated data from textboxes
 
Share this answer
 
v2
Comments
degrader404 9-May-13 4:46am    
its showing an error
Compiler Error Message: CS0128: A local variable named 'strUrl' is already defined in this scope
degrader404 9-May-13 5:15am    
plz can you solve it
Please follow my Answer.
vijay__p 9-May-13 8:22am    
Updated
It is because he has declared strUrl two times. So, do like below...
C#
string strUrl = "http://api.mVaayoo.com/mvaayooapi/MessageCompose?user=t122kes@gmail.com:9768214005&senderID=TESTSMS&receipientno={0}&msgtxt={1}&state=4";

strUrl = string.Format(strUrl, txtNumber.Text, txtMessage.Text);

//Here txtNumber is Textbox which contains number and txtMessage contains message text
 
Share this answer
 
Comments
degrader404 9-May-13 6:04am    
thanks man.it works
Most Welcome. My pleasure...:)

Thanks for accepting the answer, if you can put a 5 star, then it would be awesome.
degrader404 9-May-13 6:15am    
yeah sure.
can you help me on one more doubt ?
Yes, why not ? Tell me.
degrader404 9-May-13 6:19am    
i am posting another question.plz do sheck that
Navigate(string URL)

-> Changes the URL of a WebBrowser
 
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