VB.NET通过URL POST请求和GET请求
来源:互联网 发布:blythe淘宝哪家是正品 编辑:程序博客网 时间:2024/05/20 11:19
VB.NET
- Public Shared Function GetData(ByVal url As String, ByVal data As String) As String
- Dim request As HttpWebRequest = WebRequest.Create(url + "?" + data)
- request.Method = "GET"
- Dim sr As StreamReader = New StreamReader(request.GetResponse().GetResponseStream)
- Return sr.ReadToEnd
- End Function
- Public Shared Function PostData(ByVal url As String, ByVal data As String) As String
- ServicePointManager.Expect100Continue = False
- Dim request As HttpWebRequest = WebRequest.Create(url)
- '//Post请求方式
- request.Method = "POST"
- '内容类型
- request.ContentType = "application/x-www-form-urlencoded"
- '将URL编码后的字符串转化为字节
- Dim encoding As New UTF8Encoding()
- Dim bys As Byte() = encoding.GetBytes(data)
- '设置请求的 ContentLength
- request.ContentLength = bys.Length
- '获得请 求流
- Dim newStream As Stream = request.GetRequestStream()
- newStream.Write(bys, 0, bys.Length)
- newStream.Close()
- '获得响应流
- Dim sr As StreamReader = New StreamReader(request.GetResponse().GetResponseStream)
- Return sr.ReadToEnd
- End Function
阅读全文
1 0
- VB.NET通过URL POST请求和GET请求
- VB.NET通过URL POST请求和GET请求
- WebClient 通过get和post请求api
- WebClient 通过get和post请求api
- get请求和post请求
- get请求和post请求
- GET请求和POST请求
- GET请求和POST请求
- GET请求和POST请求
- GET请求和POST请求
- GET请求和POST请求
- POST请求和GET请求
- get请求和post请求
- 通过get或post请求URL获取返回数据
- java通过Http get post请求url获取数据
- .NET WEB后端POST和GET请求
- Asp.net GET和POST 请求
- GET和POST请求
- 使用PM2管理node项目
- JAVA常用查找之二分查找法
- Loopback Address
- ble4 连接参数
- SpringMVC Controller介绍及常用注解
- VB.NET通过URL POST请求和GET请求
- 微信菜单生成
- js el表达式在java中判断, jsp 逻辑判断 在java中运行
- 使用freemarker实现word导出
- 关于RelativeLayout中onMeasure()的理解
- 《Docker:容器与容器云》.pdf
- easyui datagrid一般创建模板
- Python: PS 图像调整--亮度调整
- USB-OTG 接收设备返回信息