Jump to content

Check if a URL Exists

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
Chan

Chan

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 204 posts
I can't find a working function which will allow me to check if a url exists?


Can anyone provide me with one? Or help me create one?

#2
Crane

Crane

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 398 posts
You could always just use simple code like:


$content = fopen($url);

if ($content) {}

else {

  // URL Does not exist

}



Or you could make a connection to port 80 and see if the connection rejects or not.