All Forums >> [Scripting] >> ASP >> read external textfile Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
I want to read an textfile from an external website. After looking around on the internet I found an sort of solution with XMLHTTP.
I use
Set xml = Server.Createobject("Microsoft.XMLHTTP") xml.open "GET", http://www.remotesite.com/test.txt, False xml.send
to open the file.
This works fine, but when the file doesn't exist my script fails. I haven't found an solution to first check if the file exists. Does somebody know how I can do this?
Set xml = Server.Createobject("Microsoft.XMLHTTP") On Error Resume Next xml.open "GET", http://www.remotesite.com/test.txt, False If Err.Number <> 0 Then 'Could not open the file....do something here Else xml.send End If On Error Goto 0