|
問一下關於以下的兩個程序
這個是其他師兄做的- Sub cc()
- Cells.ClearContents
- Set oDoc = CreateObject("htmlfile")
- With CreateObject("WinHttp.WinHttpRequest.5.1")
- .Open "GET", "http://www.cde.org.cn/transparent.do?method=spxlList&tasktype=xb&nowYearM=2014-02&acceptid=&applyTypeCde=IND&isTimetag=0¤tPageNumber=1&pageMaxNumber=340&totalPageCount=17&pageroffset=20&pageMaxNum=20&pagenum=1", False
- .send
- .WaitForResponse
- oDoc.body.innerHTML = .responsetext
- Set r = oDoc.All.Tags("table")(7).Rows
- For i = 0 To r.Length - 1
- For j = 0 To r(i).Cells.Length - 1
- Cells(i + 1, j + 1) = r(i).Cells(j).innerText
- Next j
- Next i
- Set r = Nothing
- End With
- End Sub
复制代码 這個是我做的,沒有資料整合,只做到拿資料那步- Sub Main()
- With CreateObject("WinHttp.WinHttpRequest.5.1") '
- .Open "GET", "http://www.cde.org.cn/news.do?method=changePage&pageName=service&frameStr=4", False
- .send
- .Open "GET", "http://www.cde.org.cn/transparent.do?method=spxlList&tasktype=xb&isFirst=1", False
- .send
- total_no = Split(Split(.responseText, "<font color=""#FF0000"" style=""font-weight: bolder;"">")(1), "</font>")(0)
- .Open "POST", "http://www.cde.org.cn/transparent.do?method=spxlList", False
- .setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
- .send "tasktype=xb&nowYearM=2014-11&acceptid=&applyTypeCde=IND&isTimetag=0¤tPageNumber=1&pageMaxNumber=" & total_no & "&totalPageCount=19&pageroffset=0&pageMaxNum=20&pagenum=1"
- CopyToClipbox .responseText
- End With
- End Sub
复制代码 我想問問,師兄那個程序是直接在 GET 那兒便拿了完整資料了,那條網址基本上用IE法也可以很方便拿資料出來,可是照這課程來說,應該是在 .SEND 那才會發的,請問這是否一個經驗的問題呢? 又或者是會有什麼的提示可以在抓之前大約知道呢? |
|