note 16307 deleted from function.parse-url by jimw
| From: | jimw@php.net | Date: | Fri, 21 Dec 2001 00:40:54 +0000 |
| Subject: | note 16307 deleted from function.parse-url by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-23669@lists.php.net to get a copy of this message | ||
Regarding using fopen() to check URLS, in the notes above, some of the functions leave out the
second paramater (e.g. "r" for Read-only) required by the function (perhaps some versions
of PHP don't require this?).
Also, if the URL does not have a "/" at the end, this function could return
"false."
So I recommend this version of the isValidURL function:
function isValidUrl($url) {
##if we can't open the URL, try it with a "/" at the end:
if (($fp = fopen(($url.'/'), "r")) OR ($fp = fopen($url, "r"))
return true;
else
return false;
}
Steve:)