/ Published in: PHP
If you have to test if a remote url is correct you can use CURL and get the headers returned by the http request. If you receive a 200 code, than it’s ok, else the url is not correct:
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function url_exists($url) { return ($status[1] == 200); }
URL: http://www.barattalo.it/2010/01/06/test-if-a-remote-url-exists-with-php-and-curl/