Created
June 2, 2013 16:01
-
-
Save damirarh/5693941 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = new HttpClient(); | |
// GET request | |
var getRequest = "http://hroch486.icpf.cas.cz/cgi-bin/echo.pl?key=value"; | |
var getResponse = await http.GetAsync(getRequest); | |
var getResult = await getResponse.Content.ReadAsStringAsync(); | |
// POST request | |
var postUri = new Uri("http://hroch486.icpf.cas.cz/cgi-bin/echo.pl"); | |
var postFields = new Dictionary<string, string> | |
{ | |
{ "key", "value" } | |
}; | |
var postContent = new FormUrlEncodedContent(postFields); | |
var postResponse = await http.PostAsync(postUri, postContent); | |
var postResult = await postResponse.Content.ReadAsStringAsync(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment