I am trying to send an sms from my spider program. I am using Clickatell HTTP API. Which is basically sending login info + message as a URL.
This program works very well as a stand alone C# program, but not in Gadgeteer. Problem is with WebClient, it is not supported fully or I don’t know how to use it in Gadgeteer.
WebClient client = new WebClient(); // Add a user agent header in case the requested URI contains a query. client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)"); client.QueryString.Add("user", "XXXXXXXX"); client.QueryString.Add("password", "XXXXXXXXX"); client.QueryString.Add("api_id", "XXXXXX"); client.QueryString.Add("to", "XXXXXX"); client.QueryString.Add("text", str); string baseurl = "http:" + "//api.clickatell.com/http/sendmsg"; Stream data = client.OpenRead(baseurl); StreamReader reader = new StreamReader(data); string s = reader.ReadToEnd(); data.Close(); reader.Close();
I tried MS (How to: Send Data Using the WebRequest Class) but it didn’t work.
Can you help please?