Last active
November 15, 2018 06:17
-
-
Save jackphilippi/3953305a605c18538cf6d22c7b8d7630 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
using System.Net.Http; | |
// Create a new HTTP client which we will use to send the request | |
private static readonly HttpClient client = new HttpClient(); | |
// Create a dictionary with the value(s) you want to send | |
var values = new Dictionary<string, string> | |
{ | |
{ "firstNumber", 123 }, | |
{ "secondNumber", 456 }, | |
}; | |
// Convert the dictionary above into the correct format (url encoded) to be sent over the network | |
var content = new FormUrlEncodedContent(values); | |
// Send the url encoded data via POST to a URL or IP address | |
var response = await client.PostAsync("https://testibrahim.free.beeceptor.com", content); | |
// Read the data that the URL or IP address responded with | |
var responseString = await response.Content.ReadAsStringAsync(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment