本帖最后由 suwenkai 于 2014-10-26 22:53 编辑
战战如疯 发表于 2014-10-26 14:59
下面应该是Json了吧,之前做的一个网页,用html和split能处理,心血来潮想学习下Json,但是这个网页的Json好 ...
okko.rar
(24.39 KB, 下载次数: 96)
换一种方法下载数据,哪个页面有下载excel的功能,捕捉数据后发送出来的效果。- Sub 按钮1_单击()
- Dim url, html, js, xml
- Set xml = CreateObject("MSXML2.DomDocument")
- url = "http://www.okooo.com/soccer/match/680903/odds/download/"
- PD = "MatchID=1250203"
- PD = PD & "&MakerIDList="
- PD = PD & "24,2,14,82,27,43,25,94,65,35,36,37,180,159,19,84,17,116,"
- PD = PD & "126,150,49,157,168,170,285,286,307,250,220,280,131,322,197,715,"
- PD = PD & "406,594,578,516,88,237,505,89,370,90,633,694,373,706,644,586,"
- PD = PD & "78,238,590,331,416,491,428,704,700,683,634,98,481,461,482,494,"
- PD = PD & "294,100,564,602,223,268,565,13,642,493,479,198,666,409,418,79,"
- PD = PD & "548,242,29,545,394,74,243,376,459,697,298,245,105,643,636,543,"
- PD = PD & "106,458,531,413,108,629,335,31,681,214,112,437,301,679,640,114,"
- PD = PD & "645,705,522,33,118,668,270,337,571,211,408,526,572,340,561,677,"
- PD = PD & "419,563,341,38,125,490,391,532,434,432,246,649,635,499,455,390,"
- PD = PD & "674,597,709,40,513,130,210,672,470,454,473,518,42,630,496,344,"
- PD = PD & "483,554,647,651,400,593,386,538,669,142,143,275,276,385,348,260,"
- PD = PD & "652,147,148,149,708,489,653,587,675,485,632,581,152,310,329,486,"
- PD = PD & "687,325,247,50,698,696,487,654,655,232,650,313,52,209,627,517,"
- PD = PD & "523,648,162,661,281,160,404,161,316,355,59,641,659,166,60,233,"
- PD = PD & "701,444,712,471,62,234,662,529,360,405,216,584,283,254,441,596,"
- PD = PD & "284,472,174,207,637,558,175,362,363,542,492,567,568,182,364,183,"
- PD = PD & "365,591,319,702,235,187,519,552,289,320,474,615,609,608,619,598,"
- PD = PD & "613,622,599,611,616,614"
- Set html = CreateObject("htmlfile")
- Set js = CreateObject("scriptcontrol")
- js.Language = "jscript"
- With CreateObject("msxml2.xmlhttp")
- .Open "POST", url, False
- .setRequestHeader "Host", "www.okooo.com"
- .setRequestHeader "Connection", "keep-alive"
- .setRequestHeader "Content-Length", "1740"
- .setRequestHeader "Cache-Control", "max-age=0"
- .setRequestHeader "Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
- .setRequestHeader "Origin", "http://www.okooo.com"
- .setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36"
- .setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
- .setRequestHeader "Referer", "http://www.okooo.com/soccer/match/680903/odds/"
- .setRequestHeader "Accept-Encoding", "gzip,deflate"
- .setRequestHeader "Accept-Language", "zh-CN,zh;q=0.8"
- .send (PD)
- s = .responsetext
- xml.loadxml (s)
-
- Set t = xml.childnodes(2).childnodes(3).childnodes(0).childnodes
-
- slen = t.Length - 1
-
- For i = 0 To slen
- sslen = t(i).childnodes.Length - 1
- For j = 0 To sslen
- Cells(i + 1, j + 1) = t(i).childnodes(j).Text
- Next
- Next
- End With
- End Sub
复制代码
|