我認爲這可能與外部文件有關,但我得到的錯誤是Path not found
,不知道爲什麼。下面的代碼。VBScript的CopyFile不起作用
<%
Dim fs
set fs = Server.CreateObject("Scripting.FileSystemObject")
fs.CopyFile "http://domain.com/file.xml","softvoyage.xml"
set fs = Nothing
%>DONE.
我認爲這可能與外部文件有關,但我得到的錯誤是Path not found
,不知道爲什麼。下面的代碼。VBScript的CopyFile不起作用
<%
Dim fs
set fs = Server.CreateObject("Scripting.FileSystemObject")
fs.CopyFile "http://domain.com/file.xml","softvoyage.xml"
set fs = Nothing
%>DONE.
FileSystemObject僅用於本地光盤文件。試試這個:
<%
url = "http://www.espn.com/main.html"
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "GET", url, false
xmlhttp.send ""
Response.write xmlhttp.responseText
set xmlhttp = nothing
%>
找到在http://classicasp.aspfaq.com/general/how-do-i-read-the-contents-of-a-remote-web-page.html
我不相信的CopyFile方法可以從HTTP源複製文件。我見過的源參數的唯一例子是本地文件系統中的文件:
FileSystemObject.CopyFile "c:\srcFolder\srcFile.txt", "c:\destFolder\"
如果您需要將數據從一個HTTP請求保存,檢查出IXMLHTTPRequest object。
「本地光盤文件」或通過UNC文件共享可用的文件。 – AnthonyWJones 2010-01-23 22:11:30
@安東尼:是的,謝謝。 – egrunin 2010-01-23 22:30:45