Main Site Documentation

Implementinpg the Clickatell API in SPider (4.1)


#1

Hi,
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.

http://www.clickatell.com/apis-scripts/scripts/c-scripts/

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.

http://msdn.microsoft.com/en-us/library/debx8sh9.aspx

Can you help please?

Best regards

Trevor