473,403 Members | 2,270 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Checking connection to a server

Hi,
Is it possible to test whether a given URL is reachable within using any server-side scripting?
Cheers,
Jon
Feb 18 '08 #1
7 3559
rnd me
427 Expert 256MB
Hi,
Is it possible to test whether a given URL is reachable within using any server-side scripting?
Cheers,
Jon
1. synchronous ajaxing the url. a head request is the quickest.

2. use the domainOK function below to simply check on rules, not existence.

Expand|Select|Wrap|Line Numbers
  1. function qualifyPath(paf) { var i = new Image; i.src = paf; return i.src; }
  2.  
  3. function domainOK(paf) { 
  4. var tlc = window.location;
  5.  var myDomain = tlc.hostname || tlc.host; 
  6. var paf3 = qualifyPath(paf); 
  7. var pafDomain = paf3.split(/^https?\:\/\//)[1].split(/\//)[0]; 
  8. return myDomain == pafDomain; }
  9.  
  10.  
  11.  
Feb 18 '08 #2
Btw, my original post should have read:

Hi,
Is it possible to test whether a given URL is reachable without using any server-side scripting?
Cheers,
Jon
Feb 18 '08 #3
acoder
16,027 Expert Mod 8TB
The first option suggested by rnd me should work. For an example, see the section titled 'Does a URL exist?' on this page.
Feb 18 '08 #4
The servers I need to test are remote and this method only seems to work for local paths.

Cheers,
Jon
Feb 19 '08 #5
acoder
16,027 Expert Mod 8TB
The servers I need to test are remote and this method only seems to work for local paths.
If they're from a different domain, then you will need some server-side code, but you said "without using any server-side scripting" so the answer would be that it's not possible.
Feb 19 '08 #6
Ok, thanks.

What would be easiest method of doing this with minimal server-side scripting?

Thanks,
Jon
Feb 19 '08 #7
acoder
16,027 Expert Mod 8TB
Make an http request from your server-side script. All it has to return (print/echo) is 0 or 1 (or true/false). Then the Ajax script can check the response.
Feb 19 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Steven Scaife | last post by:
Below is my ASP page, I have changed the update to read DRIAL which doesn't exist, shouldnt this throw an error, or if the connection cannot be made shouldnt it throw an error as well thanks in...
8
by: Nikola Bucic | last post by:
Could someone tell me how can I constantly check if I'm connected to internet and if possible to determine what type of connection is it. My best shot wright now is to have a timer which will...
16
by: lawrence k | last post by:
I've made it habit to check all returns in my code, and usually, on most projects, I'll have an error function that reports error messages to some central location. I recently worked on a project...
8
by: John | last post by:
Hi I am creating a db connection using the below code. Is there a way to check if the connection is open? Thanks Regards
2
by: hakkatil | last post by:
Hi to all, I have a page that inserts excel sheet to access database. I am using asp. What I want to do is to check the inserting record if it is in the database. Basicly checking the dublicate...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.