Initial
This commit is contained in:
21
Bokhantarare/Helper.cs
Normal file
21
Bokhantarare/Helper.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
|
||||
namespace Bokhantarare;
|
||||
|
||||
public class Helper
|
||||
{
|
||||
public static string Request(string requestUrl)
|
||||
{
|
||||
HttpClient client = new HttpClient();
|
||||
HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Get, requestUrl);
|
||||
requestMessage.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json"));
|
||||
|
||||
//Connect to the URL
|
||||
HttpResponseMessage response = client.SendAsync(requestMessage).Result;
|
||||
|
||||
// Get the response
|
||||
string Output = response.Content.ReadAsStringAsync().Result;
|
||||
return Output;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user