【发布时间】:2023-01-01 02:44:59
【问题描述】:
我如何将以下信息发布到本网站“http://restapi.adequateshop.com/api/Tourist” 通过 C# 代码?
tourist_name:“虚拟” tourist_email: "test123@test.com" tourist_location:“巴黎”
static void Main(string[] args)
{
//create the constructor with post type and few data
string data = "tourist_name=Mike&tourist_email=miked123@gmail.com&tourist_location=Paris";
MyWebRequest myRequest = new MyWebRequest("http://restapi.adequateshop.com/api/Tourist", "POST", data);
//show the response string on the console screen.
string Response = myRequest.GetResponse();
}
【问题讨论】: