21 lines
642 B
C#
21 lines
642 B
C#
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;
|
|
}
|
|
} |