Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
For 2023 - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Does a particular URL exist?

Posted by admin (Graham Ellis), 24 July 2005
I'm often asked how to check whether a particular URL exists - we assure people there's a function in PHP to do almost anything and yet no single function exists for this purpose. The question cropped up again this morning and here's how I answered

There is no general function to check any URL, but you can check an http:// URL for readability easily enough. The only way to test for mailto: type URLs is to send an email to the URL and see if the owner of the URL responds, and you're not going to find it very easy to check for the existance of http:// web pages within directories for which authorisation is required.

Note that testing a remote URL will cause your enquiry to be recorded in log files that the server there is probably keeping, and that you should respect the robots exclusion standard is you're doing more than a handful of tests.

I've uploaded an example script - VERY carefully filtered and I'll be keeping my eyes on it too - to test URLs.  It's here.   If you visit the script, you'll find that it reveals its own source code (nice, but be careful) and that I've added in a test to make sure that it will only accept http:// type URLs.

Posted by curtis (curtis), 8 October 2005
Nice job

I never thought about checking URLs very much, but it looks like you've come up with a nice, simple method.

On a somewhat related note, if you want to validate links, you can use the W3C's link checker.

This page is a thread posted to the opentalk forum at and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2023: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: • WEB: • SKYPE: wellho