If Inet1.StillExecuting = True Then Inet1.Cancel
Inet1.Execute "http://dongchangliduxg.soufun.com/bbs/2424700935~-1/135850007_135850007.htm", "GET"
这样没有返回任何信息 不正常啊 应该得到源代码啊
Inet1.Execute "http://dongchangliduxg.soufun.com/bbs/2424700935~-1/135850007_135850007.htm", "GET"
这样没有返回任何信息 不正常啊 应该得到源代码啊
解决方案 »
- VB数组中的最大值问题!
- 如何将软件在CSDN上发布
- 高分求助关于图形学的程序!
- 在字符串中提取数字的问题,忘大家不吝指教!
- 急求送分,有两个listbox控件,怎么把listbox1里面的所有内容,放进listbox2.
- 我现在只有18岁,是继续上学?还是到工作中锻炼一下?(一个徘徊的男孩)
- 只想用recordset保存从数据库中提取出来的数据,之后在recordset上的操作与数据库无关,如何才能实现?
- 请问在VB里面怎么用API和旧风格的打开文件对话框同时打开多个文件呀?在线送分~~~
- 如何修改RichtextBox字体的字符集?急!急!
- vb 没有用了!
- 请问vba可以调用视图吗?
- VB编译报错,急急急!!!
On Error GoTo reStart
reStart:
DoEvents
Dim stime, ntime
Dim XmlHttp
' St "获取网页源码"
Set XmlHttp = CreateObject("Microsoft.XMLHTTP")
XmlHttp.Open "GET", strURL, True
XmlHttp.SetRequestHeader "If-Modified-Since", "0"
XmlHttp.Send
stime = Now '获取当前时间
While XmlHttp.ReadyState <> 4
DoEvents
ntime = Now '获取循环时间
If DateDiff("s", stime, ntime) > 10 Then getHtmlStr = "OutTime":Exit Function '判断超出3秒即超时退出过程
Wend
getHtmlStr = StrConv(XmlHttp.ResponseBody, vbUnicode)
If getHtmlStr = "" Then getHtmlStr = "OutTime"
Set XmlHttp = Nothing
DoEvents
End FunctionUTF-8网站获取源代码的函数:Function Utf8ToUnicode(ByRef Utf() As Byte) As String
Dim utfLen As Long
utfLen = -1
On Error Resume Next
utfLen = UBound(Utf)
If utfLen = -1 Then Exit Function
On Error GoTo 0
Dim i As Long, j As Long, k As Long, N As Long
Dim B As Byte, cnt As Byte
Dim Buf() As String
ReDim Buf(utfLen)
i = 0
j = 0
Do While i <= utfLen
B = Utf(i)
If (B And &HFC) = &HFC Then
cnt = 6
ElseIf (B And &HF8) = &HF8 Then
cnt = 5
ElseIf (B And &HF0) = &HF0 Then
cnt = 4
ElseIf (B And &HE0) = &HE0 Then
cnt = 3
ElseIf (B And &HC0) = &HC0 Then
cnt = 2
Else
cnt = 1
End If
If i + cnt - 1 > utfLen Then
Buf(j) = "?"
Exit Do
End If
Select Case cnt
Case 2
N = B And &H1F
Case 3
N = B And &HF
Case 4
N = B And &H7
Case 5
N = B And &H3
Case 6
N = B And &H1
Case Else
Buf(j) = Chr(B)
GoTo Continued:
End Select
For k = 1 To cnt - 1
B = Utf(i + k)
N = N * &H40 + (B And &H3F)
Next
Buf(j) = ChrW(N)
Continued:
i = i + cnt
j = j + 1
Loop
Utf8ToUnicode = Join(Buf, "")
End Function
Function getHtmlStr$(strURL$) '获取源码
On Error GoTo reStart
Dim smt() As Byte
reStart:
DoEvents
Dim stime, ntime
Dim XmlHttp
' St "获取网页源码"
Set XmlHttp = CreateObject("Microsoft.XMLHTTP")
XmlHttp.Open "GET", strURL, True
XmlHttp.SetRequestHeader "If-Modified-Since", "0"
XmlHttp.Send
stime = Now '获取当前时间
While XmlHttp.ReadyState <> 4
DoEvents
ntime = Now '获取循环时间
If DateDiff("s", stime, ntime) > 5 Then getHtmlStr = "OutTime": Exit Function '判断超出3秒即超时退出过程
DoEvents
Wend
'getHtmlStr = StrConv(XmlHttp.ResponseBody, vbUnicode)
smt = XmlHttp.ResponseBody
getHtmlStr = Utf8ToUnicode(smt)
If getHtmlStr = "" Then getHtmlStr = "OutTime"
Set XmlHttp = Nothing
DoEvents
End Function