Submit Your Article Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > Classic ASP

Reply
 
LinkBack Thread Tools
Old October 20th, 2005, 06:36 AM   #1
New Member
 

Join Date: May 2005
Location: bath - england
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 simonneaves is on a distinguished road
Detect whether connection to external url is possible

Hi, I have a little problem with a script which I set up a while back. The script connects to a text file on a product supplier's site which has lists of all of the products which are currently in stock. I then run a script to update my database with all out of stock products so that they don't appear on my site.

It works like a dream, except that BT just cut the cables for the suppliers web server. This means that my script can't connect to the text file, and I get horrible error messages.

Does anybody know how to implement an error detection that will prevent the script from running if the connection to the external text document cannot be made. I obviously want it so that the script is simply ignored, and no error messages are presented.

Is there a script which says "if this url can be found then run the script below"

My connection code below:
Code:
Set objXmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP") 
	objXmlHttp.open "GET", "http://www.domain.com/available.csv", False 
	objXmlHttp.send 
	strTextFile = objXmlHttp.responseText
Thanks
simonneaves is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 20th, 2005, 07:32 AM   #2
Rob
Elite Veteran
SuperMember
 
Rob's Avatar
 

Join Date: Jul 2003
Location: Southern UK
Age: 35
Posts: 3,126
Blog Entries: 7
Thanks: 28
Thanked 22 Times in 19 Posts
Rep Altering Power: 0 Rob is a jewel in the rough Rob is a jewel in the rough Rob is a jewel in the rough
I'm not 100% sure, but I'm pretty sure the objXmlHttp.open or objXmlHttp.send methods have return values.

If not, you could use on error resemu next and check for the existance of an err value (which will indicate there was a problem connecting)

Hope this helps.
__________________
Rob - Webforumz Founder
Web Designer Support Network || Personal Project: Sanctuary for Student Midwives
Rob is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 24th, 2005, 08:07 AM   #3
Highly Reputable Member
 

Join Date: Jul 2003
Location: Ipswich, UK
Posts: 686
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 Smokie will become famous soon enough
Code:
If objXmlHttp.status = "200" Then
Smokie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 24th, 2005, 09:12 AM   #4
New Member
 

Join Date: May 2005
Location: bath - england
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 simonneaves is on a distinguished road
aha!

Thanks for this.

The document I'm trying to connect to is working ok again now, so all is well.

I've tried connecting to a document that doesn't exist, or a domain that doesn't exist, and script times out though. I don't know wheteher I'm accurately simulating their server going down by doing this.

Thanks though, this certainly helps.

Si.
simonneaves is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks

Tags
detect , whether , connection , external , url , possible


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Detect mouse location etc.... abrogard JavaScript 1 December 6th, 2007 08:22 AM
Popup Name Detect RobinDeanDotCom JavaScript 0 February 24th, 2007 06:35 PM
Detect IE Totti JavaScript 4 December 5th, 2006 08:48 PM
Possible to detect which stylesheet in use? mar2195 JavaScript 9 November 25th, 2006 07:43 AM
detect pop-up blocker - different bert JavaScript 0 July 22nd, 2005 06:30 AM


Search Engine Optimization by vBSEO 3.2.0 RC8