C# 傳送POST請求
HttpWebRequest req = WebRequest.Create("http://test.do.do") as HttpWebRequest;
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = Encoding.UTF8.GetByteCount("username=admin");
string rr = "username=admin";
using (StreamWriter sw = new StreamWriter(req.GetRequestStream()))
sw.Write("username=admin");
HttpWebResponse res = req.GetResponse() as HttpWebResponse;
string responseString = "";
using (Stream responseStream = res.GetResponseStream())
{
using (StreamReader srResponse = new StreamReader(responseStream))
{
//返回的json格式的資料
responseString = srResponse.ReadToEnd();
}
}
string aa = responseString;
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = Encoding.UTF8.GetByteCount("username=admin");
string rr = "username=admin";
using (StreamWriter sw = new StreamWriter(req.GetRequestStream()))
sw.Write("username=admin");
HttpWebResponse res = req.GetResponse() as HttpWebResponse;
string responseString = "";
using (Stream responseStream = res.GetResponseStream())
{
using (StreamReader srResponse = new StreamReader(responseStream))
{
//返回的json格式的資料
responseString = srResponse.ReadToEnd();
}
}
string aa = responseString;
相關文章
- 使用C#傳送POST請求C#
- Postman傳送Post請求Postman
- Java傳送Post請求Java
- java傳送GET和post請求Java
- python傳送HTTP POST請求PythonHTTP
- post 封裝Map 傳送請求封裝
- PHP傳送POST和GET請求PHP
- 用Fiddler 傳送post請求
- linux用curl傳送post請求Linux
- 以Raw的方式傳送POST請求
- httprequest- post- get -傳送請求HTTP
- php 利用socket傳送GET,POST請求PHP
- java傳送http的get、post請求JavaHTTP
- 使用Postman傳送POST請求的指南Postman
- java傳送post請求 ,請求資料放到body裡Java
- SpringMVC中如何傳送GET請求、POST請求、PUT請求、DELETE請求。SpringMVCdelete
- 【轉】怎麼用PHP傳送HTTP請求(POST請求、GET請求)?PHPHTTP
- postman(二):使用postman傳送get or post請求Postman
- curl 傳送 POST 請求的四種方式
- file_get_contents傳送post請求
- 【Postman】6 Postman 傳送post請求-Json格式PostmanJSON
- cURL實現傳送Get和Post請求(PHP)PHP
- oracle使用utl_http包傳送post請求OracleHTTP
- jmeter之傳送json資料的post請求JMeterJSON
- Go語言開發傳送Get和Post請求Go
- 利用post請求傳送內容進行爬蟲爬蟲
- scrapy-redis原始碼解讀之傳送POST請求Redis原始碼
- axios傳送post請求,request.getParamter接收不到iOS
- 關於用URL類傳送POST請求的問題?
- 『動善時』JMeter基礎 — 14、使用JMeter傳送Post請求JMeter
- python+pytest介面自動化傳送post請求Python
- Golang:使用go-resty/resty傳送http請求get和postGolangRESTHTTP
- 傳送GET請求 示例
- HttpClient--傳送請求HTTPclient
- perl傳送http請求HTTP
- java傳送http請求JavaHTTP
- nGrinder中快速編寫groovy指令碼04-傳送POST請求指令碼
- 『居善地』介面測試 — 5、使用Requests庫傳送POST請求