Does a particular URL exist?A difficult question and one there isn't a general answer to - but you can check whether an http:// URL is readable which is often the question that's being asked. With a URL such as a mailto:, the only way to check whether it exists is to send an email to it and see if you get an answer back from the address owner. You also need to take care with testing like this to ensure that the user can't enter local file URLs on your server and use it to check the existance (or otherwise) of files / directories ....Checking URL http://www.wellho.net/net/new.html This URL s readable Please enter a URL you would like to validate (existance check): Note - in order to save myself the need to monitor the use of this script, I have only loaded it here it its tested (HTML) form and the form just above will not work. You are welcome AT YOUR OWN RISK to test the code that's presented below on your own server. Unless you are very sure of what you are doing, I advise you NOT to put this script onto a live Internet server Copyright Well House Consultants 2005 Source code of this example:
<?php |
This is http://www.wellho.net/demo/urlex.html See source code here • More examples - same topic here Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY Phone: +44 (0) 1225 708 225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net |