public string getUrlJson(string url)
{
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "post";
request.ContentType = "application/json;charset=UTF-8";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
string json = getResponseString(response);
return json;
}
catch (Exception e)
{
throw;
}
}
private static string getResponseString(HttpWebResponse response)
{
string json = null;
using (StreamReader reader = new StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("UTF-8")))
{
json = reader.ReadToEnd();
}
return json;
}