Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void TestMethod1()
- {
- HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("https://www.invoicera.com/app/api/xml/1.1/");
- request.Credentials = new NetworkCredential("MYKEY", "jj");
- request.Method = "POST"; // Post method
- request.ContentType = "text/xml";
- request.Accept = "application/xml";
- string xml = "<?xml version="1.0" encoding="utf-8"?><request method="getAccountInfo"></request>";
- byte[] bytes = Encoding.UTF8.GetBytes(xml);
- request.ContentLength = bytes.Length;
- using (Stream putStream = request.GetRequestStream())
- {
- putStream.Write(bytes, 0, bytes.Length);
- }
- using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
- using (StreamReader reader = new StreamReader(response.GetResponseStream()))
- {
- string resp = reader.ReadToEnd();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement