Logo
技术 C#

WebClient请求接口,get和post方法

photo
Pastore Antonio

2022年05月13日

1,get方式

             string URI = "url";
            //实例化
            WebClient client = new WebClient();
           // client.UseDefaultCredentials = true;
            return Encoding.UTF8.GetString(client.DownloadData(URI));

2,post方式

             string URI = "url";
            string myParameters = "key=" + key + "&system_id=" + System_id + "";
            //实例化
            WebClient client = new WebClient();
          //  client.UseDefaultCredentials = true;
            client.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
            client.Encoding = Encoding.UTF8;
            return client.UploadString(URI, myParameters);
本文为原创文章,请注意保留出处!
修复群晖Synology Drive client右键菜单缺失问题 Local, clean & environmental 作者:Pastore Antonio
1808 浏览量
1785 浏览量
configure: error: Package requirements (oniguruma) were not met Local, clean & environmental 作者:Pastore Antonio
1526 浏览量
Adobe Acrobat Pro 激活 Local, clean & environmental 作者:Pastore Antonio
1522 浏览量
追寻日出,找回自己 Local, clean & environmental 作者:Pastore Antonio
1489 浏览量