我正在使用经典的 asp 和 JSON 将 html 转换为 pdf。我使用以下方式发送请求:
''Convert output to pdf
varURL = "https://" & varServerLive & "/import/" & fileName
postURL = "https://v2.convertapi.com/convert/htm/to/pdf?Secret=SECRET_KET&File=" & varURL & "&StoreFile=true"
parmToSend = "{""Parameters"":[{""Name"":""File"",""FileValue"":{""url"": """ & varURL & """}}," & _
"{""Name"":""WebHook"",""Value"":""" & varURL & """}" & _
"]}"
Set ServerXmlHttp = Server.CreateObject("MSXML2.XMLHTTP.6.0")
ServerXmlHttp.open "POST", postURL
ServerXmlHttp.setRequestHeader "Accept", "application/json"
ServerXmlHttp.setRequestHeader "Content-Type", "application/json"
ServerXmlHttp.send parmToSend
''Get response
responseText = ServerXmlHttp.responseText
response.write(responseText)
set myJson = JSON.parse(responseText)
varFileUrl = myJson.Files.Url
response.write(varFileUrl)
我得到以下回复:
响应文本:
{"ConversionCost":2,"Files":[{"FileName":"54-25062020177.pdf","FileExt":"pdf","FileSize":48596,"FileId":"542c6f079fe5722bdbac2f73f84652d3","Url":"https://v2.convertapi.com/d/542c6f079fe5722bdbac2f73f84652d3/54-25062020177.pdf"}]}
这一切都很好,但是当我尝试返回 fileURL 时出现错误:
Microsoft VBScript 运行时错误“800a01b6”
对象不支持此属性或方法:'url'
/docs/members/cert.asp,第 122 行
您是否看到没有返回 url 的任何原因?我是否正确调用了 url(例如 myJson.Files.Url)?
任何帮助将非常感激。