Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static string SendJson(string url, string data)
- {
- var httpReq = (HttpWebRequest) WebRequest.Create(url);
- httpReq.ContentType = "application/json";
- httpReq.Method = "POST";
- using (var writer = new StreamWriter(httpReq.GetRequestStream()))
- {
- writer.Write(data);
- writer.Flush();
- writer.Close();
- var httpResp = (HttpWebResponse) httpReq.GetResponse();
- using (var reader = new StreamReader(httpResp.GetResponseStream()))
- return reader.ReadToEnd();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment