Detect whether connection to external url is possible

This is a discussion on "Detect whether connection to external url is possible" within the Classic ASP section. This forum, and the thread "Detect whether connection to external url is possible are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Oct 20th, 2005, 10:36
Junior Member
Join Date: May 2005
Location: bath - england
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
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: Select all
Set objXmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP") 
	objXmlHttp.open "GET", "http://www.domain.com/available.csv", False 
	objXmlHttp.send 
	strTextFile = objXmlHttp.responseText
Thanks
Reply With Quote

  #2 (permalink)  
Old Oct 20th, 2005, 11:32
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,951
Blog Entries: 7
Thanks: 7
Thanked 3 Times in 3 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
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 - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
Reply With Quote
  #3 (permalink)  
Old Oct 24th, 2005, 12:07
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
Code: Select all
If objXmlHttp.status = "200" Then
Reply With Quote
  #4 (permalink)  
Old Oct 24th, 2005, 13:12
Junior Member
Join Date: May 2005
Location: bath - england
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
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.
Reply With Quote
Reply

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

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 Forum 1 Dec 6th, 2007 12:22
Popup Name Detect RobinDeanDotCom JavaScript Forum 0 Feb 24th, 2007 22:35
Detect IE Totti JavaScript Forum 4 Dec 6th, 2006 00:48
Possible to detect which stylesheet in use? mar2195 JavaScript Forum 9 Nov 25th, 2006 11:43
detect pop-up blocker - different bert JavaScript Forum 0 Jul 22nd, 2005 10:30


All times are GMT. The time now is 21:55.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43