我有以下代码:
Function filejson(json)
Dim objStream, strData
Set objStream = CreateObject("ADODB.Stream")
objStream.CharSet = "utf-8"
objStream.Open
objStream.LoadFromFile(json)
strData = objStream.ReadText()
filejson = strData
End Function
Function http2json(url)
Set http = CreateObject("Microsoft.XmlHttp")
http.open "GET", url, FALSE
http.send "" '<------- Line 13
http2json=http.responseText
End Function
Function str2json(json,value)
Set scriptControl = CreateObject("MSScriptControl.ScriptControl")
scriptControl.Language = "JScript"
scriptControl.AddCode("x="& json & ";")
str2json= scriptControl.Eval( "x"& value )
End Function
Function get_json_from_file(json,value)
get_json_from_file=str2json(filejson(json),value)
End Function
Function get_json_from_http(url,value)
get_json_from_http=str2json(http2json(url),value)
End Function
Function save_json_from_http(url,loc)
Set fso = CreateObject("Scripting.FileSystemObject")
fullpath = fso.GetAbsolutePathName(loc)
Dim objStream, strData
Set objStream = CreateObject("ADODB.Stream")
objStream.CharSet = "utf-8"
objStream.Open
objStream.WriteText http2json(url)
objStream.SaveToFile fullpath, 2
save_json_from_http=fullpath
End Function
Wscript.Echo save_json_from_http("http://api.themoviedb.org/3/authentication/session/new?api_key=#####some_api_key_example#####&request_token=#####some_default_request_token######&_ctime_json_=1372670635.164760555","tmdb\temp\_tmdb_sock_w.164519518.2109")
当我运行此代码时,出现以下错误。
如果我删除 &request_token=######some_default_request_token######
它就可以正常工作。
我也尝试过这个:我再次添加了 request_token
,然后我只是在其中输入了一个随机字符,例如 rexfuest_token
,奇怪的是它起作用了。 msxml3.dll 中似乎有错误的解析。带有 request_token 词。
想法?
最佳答案
此问题可能与 Windows 中的安全问题有关。解决此问题的最佳方法是将 Microsoft.XmlHttp
/MSXML2.XMLHTTP
替换为 MSXML2.ServerXMLHTTP
。
我看到这个主题已经有近 2 年历史了,很可能主题启动者已经解决了这个问题。几个小时前我遇到了同样的问题,谷歌为我提供了几个链接。其中有一些:
- https://social.msdn.microsoft.com/Forums/en-US/1abda1ce-e23c-4d0e-bccd-a323aa7f2ea5/access-is-denied-while-using-microsoftxmlhttp-to-get-a-url-link-in-vbscript-help?forum=xmlandnetfx
- https://support.webafrica.co.za/index.php?/Knowledgebase/Article/View/615/41/msxml3dll-error-80070005-access-is-denied---loading-xml-file
- http://www.experts-exchange.com/Programming/Languages/Scripting/ASP/Q_27305017.html
关于vbscript - msxml3.dll 访问被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17401413/