Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


read external textfile

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,43204
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> read external textfile
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 read external textfile - 2/14/2007 8:04:27 PM   
  Thuurke

 

Posts: 2
Score: 0
Joined: 2/14/2007
Status: offline
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
 
 
Post #: 1
 
 RE: read external textfile - 2/15/2007 2:40:08 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
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

(in reply to Thuurke)
 
 
Post #: 2
 
 RE: read external textfile - 2/15/2007 4:56:42 AM   
  Thuurke

 

Posts: 2
Score: 0
Joined: 2/14/2007
Status: offline
Thank you!

How simple it can be.....

(in reply to ebgreen)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> read external textfile Page: [1]
Jump to:





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
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts