这里没有服务器, 但这里是经过测试的 vbscrip 版本, 要在 asp 中使用它, 您只需要用服务器替换天顶Object 。 CreateObject
function download(url, destination)
download = false
on error resume next
set xml = CreateObject("Microsoft.XMLHTTP")
xml.Open "GET", url, False
xml.Send
if err.number = 0 then
if xml.readystate = 4 then
if xml.status = 200 then
wscript.echo xml.readystate
wscript.echo xml.status
set oStream = createobject("Adodb.Stream")
const adTypeBinary = 1, adSaveCreateOverWrite = 2, adSaveCreateNotExist = 1
oStream.type = adTypeBinary
oStream.open
oStream.write xml.responseBody
oStream.saveToFile destination, adSaveCreateOverWrite
oStream.close
set oStream = nothing
download = true
end if
end if
end if
set xml = Nothing
end function