码迷,mamicode.com
首页 > Web开发 > 详细

Http请求

时间:2021-06-18 19:08:41      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:reading   request   div   using   ace   string   name   nbsp   class   

using System;
using System.Net.Http;
using System.Net.Http.Json;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static async Task Main(string[] args)
        {
            HttpClient client = new HttpClient();
            string url = @"http://47.104.4.215/spi?code=S20210422002";
            HttpRequestMessage msg = new HttpRequestMessage(HttpMethod.Get, url);
            msg.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36");
            var reponse = await client.SendAsync(msg);
            Console.WriteLine(await reponse.Content.ReadFromJsonAsync<object>());
        }
    }
}

 

Http请求

标签:reading   request   div   using   ace   string   name   nbsp   class   

原文地址:https://www.cnblogs.com/CelonY/p/14897192.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!