public void PostNameValues(string value1, string value2)
{
// Create the form values
var formValues = "name1=" + value1 + "&name2=" + value2;
// Create POST content
var content = Gadgeteer.Networking.POSTContent.CreateTextBasedContent(formValues);
// Create the request
var request = Gadgeteer.Networking.HttpHelper.CreateHttpPostRequest(
@"http://www.mjonesweb.co.uk/api/values" // the URL to post to
, content // the form values
, "application/x-www-form-urlencoded" // the mime type for an HTTP form
);
// Post the form
request.SendRequest();
}
Stuff - mainly geek, a little diabetes, some rant. Possibly all three in the same post. Basically anything I find interesting and/or worth sharing. These are my personal views, unless I've been hacked.
Sunday, 21 July 2013
How to post an HTTP form with .Net Micro Framework
This snippet of code shows how to use the .Net Micro Framework to create a representation of an HTTP form, and post it to a URL:
Labels:
.Net,
c#,
Gadgeteer,
Micro Framework
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment