- Call DownloadFile("http://iframe.ip138.com/ic.asp", "ip.txt")
- Function DownloadFile(URL,SavePath)
- On Error Resume Next
- Dim fso, xPost
- Set fso= Wscript.Createobject("Scripting.FileSystemObject")
- Set xPost = createObject("Microsoft.XMLHTTP")
- xPost.Open "GET",URL,0 ''''下载文件的地址
- xPost.Send()
- Set sGet = CreateObject("ADODB.Stream")
- sGet.Mode = 3
- sGet.Type = 1
- sGet.Open()
- sGet.Write(xPost.responseBody)
- sGet.SaveToFile SavePath,2 ''''保存文件的路径和文件名
- if (fso.FileExists(SavePath)) Then '检测文件是否存在
- DownloadFile = True
- else
- DownloadFile = False
- end if
- set fso=Nothing
- End Function
复制代码
|