Search code examples
asp-classicvbscriptfilesystemobject

VBScript's CopyFile not working


I think it may have something to do with the external file but I am getting the error Path not found and don't know why. Code below.

<%

Dim fs
set fs = Server.CreateObject("Scripting.FileSystemObject")
fs.CopyFile "http://domain.com/file.xml","softvoyage.xml"
set fs = Nothing

%>DONE.

Solution

  • The FileSystemObject is made for local disc files ONLY. Try this:

    <%
        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 
    %>
    

    Found at http://classicasp.aspfaq.com/general/how-do-i-read-the-contents-of-a-remote-web-page.html