read external textfile

Author Message
Thuurke

  • Total Posts : 2
  • Scores: 0
  • Reward points : 0
  • Joined: 2/14/2007
  • Status: offline
read external textfile Wednesday, February 14, 2007 9:04 PM (permalink)
0
Hello,
 
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?
 
Greeting,
 
Arthur
 
#1
    ebgreen

    • Total Posts : 8227
    • Scores: 98
    • Reward points : 0
    • Joined: 7/12/2005
    • Status: offline
    RE: read external textfile Thursday, February 15, 2007 3:40 AM (permalink)
    0
    Try 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 

    "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
    Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
    http://www.visualbasicscript.com/m_47117/tm.htm
     
    #2
      Thuurke

      • Total Posts : 2
      • Scores: 0
      • Reward points : 0
      • Joined: 2/14/2007
      • Status: offline
      RE: read external textfile Thursday, February 15, 2007 5:56 AM (permalink)
      0
      Thank you!
       
      How simple it can be.....
       
      #3

        Online Bookmarks Sharing: Share/Bookmark

        Jump to:

        Current active users

        There are 0 members and 1 guests.

        Icon Legend and Permission

        • New Messages
        • No New Messages
        • Hot Topic w/ New Messages
        • Hot Topic w/o New Messages
        • Locked w/ New Messages
        • Locked w/o New Messages
        • Read Message
        • Post New Thread
        • Reply to message
        • Post New Poll
        • Submit Vote
        • Post reward post
        • Delete my own posts
        • Delete my own threads
        • Rate post

        2000-2012 ASPPlayground.NET Forum Version 3.9