|
本帖最后由 html2013 于 2013-6-16 18:13 编辑
- Sub Test()
- On Error Resume Next
- sr = encodeURI("黄精")
- With CreateObject("microsoft.xmlhttp")
- .Open "GET", "http://www.nature-museum.net/Ajaxserver/server.ashx?service=spdict&method=querybynameauto&format=json&lname=&aname=" & sr, False
- .setRequestHeader "x-requested-with", "XMLHttpRequest"
- .setRequestHeader "Connection", "Keep-Alive"
- .send
- str1 = "a=" & .responsetext
- With CreateObject("MSScriptControl.ScriptControl")
- .Language = "JScript"
- .AddCode str1
- n = .Eval("a.length")
- For p = 0 To n - 1
- Cells(p + 1, 1) = .Eval("a[" & p & "].Name_Zh")
- Cells(p + 1, 2) = .Eval("a[" & p & "].Name_Latin")
- Cells(p + 1, 3) = .Eval("a[" & p & "].SAuthor")
- Cells(p + 1, 4) = .Eval("a[" & p & "].FamilyGenus.FamilyName_Zh")
- Cells(p + 1, 5) = .Eval("a[" & p & "].FamilyGenus.FamilyName_Latin")
- Cells(p + 1, 6) = .Eval("a[" & p & "].FamilyGenus.GenusName_Zh")
- m = .Eval("a[" & p & "].NormalNamesList.length")
- For j = 0 To m - 1
- Cells(p + 1, j + 7) = .Eval("a[" & p & "].NormalNamesList[" & j & "].Name")
- Next j
- Next p
- End With
- End With
- End Sub
- Function encodeURI(becoded As String) As String 'url编码
- Set JS = CreateObject("msscriptcontrol.scriptcontrol")
- JS.Language = "JavaScript"
- encodeURI = JS.Eval("encodeURIComponent('" & becoded & "');")
- End Function
复制代码
|
|