public static string HttpPost(string tagUrl, string pars) { string result; using (HttpWebResponse response = WeinXinUtility.CreatePostHttpResponse(tagUrl, pars, null, null, Encoding.UTF8, null)) { StreamReader reader = new StreamReader(response.GetResponseStream()); result = reader.ReadToEnd(); } return(result); }
public string post_prepay_id() { string postback = WeinXinUtility.HttpPost("https://api.mch.weixin.qq.com/pay/unifiedorder", this.Xml); XmlDocument xmlDoc = new XmlDocument(); backxml = postback; xmlDoc.LoadXml(postback); if (xmlDoc.DocumentElement.SelectSingleNode("err_code") != null) { backcode = xmlDoc.DocumentElement.SelectSingleNode("err_code").InnerText; } if (xmlDoc.DocumentElement.SelectSingleNode("prepay_id") != null) { prepay_id = xmlDoc.DocumentElement.SelectSingleNode("prepay_id").InnerText; } if (xmlDoc.DocumentElement.SelectSingleNode("code_url") != null) { code_url = xmlDoc.DocumentElement.SelectSingleNode("code_url").InnerText; } return(postback); }