Guest User

Untitled

a guest
Feb 21st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. var request = (HttpWebRequest)WebRequest.Create("www.xyz.com");
  2. request.Method = "POST";
  3. request.ContentType = "application/x-www-form-urlencoded";
  4. request.KeepAlive = false;
  5. request.Headers.Add("Authorization", "Handshake");
  6. byte[] bodyData;
  7. bodyData = Encoding.UTF8.GetBytes(input_data);
  8. request.ContentLength = bodyData.Length;
  9. request.GetRequestStream().Write(bodyData, 0, bodyData.Length);
  10. request.GetRequestStream().Flush();
  11. request.GetRequestStream().Close();
  12.  
  13. using (var response = request.GetResponse())
  14. {
  15. using (var reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
  16. {
  17. string output_data = reader.ReadToEnd();
  18. }
  19.  
  20. response.Close();
  21. }
Add Comment
Please, Sign In to add comment