Test is in the process of web data transcoding appear problem, but don't know why, because sometimes the same site is normal, sometimes is not normal!
To collect the following sites inside the tender information list, and then obtain the bidding information for each url,
[http://cz.fjzfcg.gov.cn/n/webfjs/secpag.do?sid=200100001&zzxs=fzx&level=province]
Because ajax, data from the winhttp. Open "get" [http://cz.fjzfcg.gov.cn/n/webfjs/queryPageData.do?rows=20&sid=200100001&zzxs=fzx&level=province&page=page],
To get more bidding information website to get the source code and loop transcoding,,,
In the process of transcoding will occasionally appear problem, at first thought it was winhttp. The status of the problem, then a large number of tests found that the problem is in the write strBod this way, that is to say, have a chance in the web page data will be collected directly write Objstream object, will stop at the problems, in this step, cause not behind the line,,,
What a great god have what opinion?
================about the process of the=====================
.
1. The first through the winhttp get home page, through a certain regular matching url of the page all bidding information and relevant information
Will get all the url as a MatchCollection
Circle the MatchCollection
In the loop body: winhttp. Open "get" every url
When they get the winhttp web data. Responsebody transcoding card master [occasionally, a total of 20 url, or after normal circulation, or gets stuck, arbitrary when a url is likely to be]
transcoding functions:
Public Function BytesToBstr (strBody CodeBase)
Dim ObjStream
The Set ObjStream=CreateObject (" Adodb. Stream ")
With ObjStream
. Type=1
. Mode=3
. Open
'HeHe. StatusBar1. Panels (3). The Text=HeHe. M & amp; "TestStatusAAAAAAAAA
"The.write strBod 'will stuck place
'HeHe. StatusBar1. Panels (3). The Text=HeHe. M & amp; "TestStatusBBBBBBBBB
". The position=0
Type=2
The Charset=CodeBase
BytesToBstr=. ReadText
. Close
End With
The Set ObjStream=Nothing
End the Function
CodePudding user response:
Webbrowser seems better to use, with the content of the tree structure, knew the web structure, go to the corresponding data is simpler