vb.net 读取网页源码(支持各种编码)

前端之家收集整理的这篇文章主要介绍了vb.net 读取网页源码(支持各种编码)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Public Function LobDotCn(ByVal url_Link As String,ByVal IsGb2312 As Boolean)

On Error Resume Next
Dim XmlHttp As Object
XmlHttp = CreateObject("Microsoft.XMLHttp")
XmlHttp.Open("POST",url_Link,False)
XmlHttp.Send()
Dim WebContent As Object
Dim Str_WebContent As String
If IsGb2312 Then
WebContent = XmlHttp.ResponseBody
Str_WebContent = System.Text.Encoding.Default.GetString(WebContent)
Else
WebContent = XmlHttp.ResponseText
Str_WebContent = WebContent.ToString
End If
XmlHttp = Nothing
LobDotCn = Str_WebContent

End Function

第二个参数 为编码转化参数

原文链接:https://www.f2er.com/vb/261584.html

猜你在找的VB相关文章