{"id":142,"date":"2010-01-11T16:37:44","date_gmt":"2010-01-11T21:37:44","guid":{"rendered":"http:\/\/stein.everybody.org\/brain\/?p=142"},"modified":"2011-03-10T10:57:27","modified_gmt":"2011-03-10T15:57:27","slug":"c-sharp-submit-xml","status":"publish","type":"post","link":"https:\/\/jeremystein.com\/brain\/c-sharp-submit-xml\/","title":{"rendered":"C# Submit XML"},"content":{"rendered":"<p>Here is the Main method for a C# program that will send the specified XML file to the given URL:<\/p>\n<pre>static void Main(string[] args)\n{\n  byte[] fileContents = File.ReadAllBytes(args[0]);\n\n  WebRequest request = WebRequest.Create(args[1]);\n  request.Method = \"POST\";\n  request.ContentType = \"text\/xml\";\n  request.ContentLength = fileContents.Length;\n  Stream postStream = request.GetRequestStream();\n  postStream.Write(fileContents, 0, fileContents.Length);\n  postStream.Close();\n\n  Console.WriteLine(new StreamReader(request.GetResponse().GetResponseStream()).ReadToEnd());\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Here is the Main method for a C# program that will send the specified XML file to the given URL: static void Main(string[] args) { byte[] fileContents = File.ReadAllBytes(args[0]); WebRequest request = WebRequest.Create(args[1]); request.Method = &#8220;POST&#8221;; request.ContentType = &#8220;text\/xml&#8221;; request.ContentLength = fileContents.Length; Stream postStream = request.GetRequestStream(); postStream.Write(fileContents, 0, fileContents.Length); postStream.Close(); Console.WriteLine(new StreamReader(request.GetResponse().GetResponseStream()).ReadToEnd()); }<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-142","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/posts\/142","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/comments?post=142"}],"version-history":[{"count":0,"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/posts\/142\/revisions"}],"wp:attachment":[{"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/media?parent=142"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/categories?post=142"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/tags?post=142"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}