public string SubmitInvoicePost(string obj, string url, UserAuthorization tempUser)
{
WriteLog.DoWriteLog("调用接口提交数据" + url + "JSON(传入的参数)", obj, tempUser);
var order = obj;
using (var client = new HttpClient())
{
byte[] bytes = Encoding.UTF8.GetBytes(order);
using (StreamContent sc = new StreamContent(new MemoryStream(bytes)))
{
sc.Headers.ContentLength = bytes.Length;
sc.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/x-www-form-urlencoded");
var result = client.PostAsync(url, sc).Result;
var ObjectReulst = result.Content.ReadAsStringAsync().Result;
WriteLog.DoWriteLog("调用接口提交数据" + url + "(传出的数据)", ObjectReulst,
C# httpclient 调用接口
最新推荐文章于 2024-05-18 16:54:01 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)