note 16307 added to function.parse-url
| From: | smk at bigmediastudios dot com | Date: | Wed, 24 Oct 2001 12:57:59 +0000 |
| Subject: | note 16307 added to function.parse-url | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-19372@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:)
--
http://www.php.net/manual/en/function.parse-url.php
http://master.php.net/manage/user-notes.php?action=edit+16307
http://master.php.net/manage/user-notes.php?action=delete+16307
http://master.php.net/manage/user-notes.php?action=reject+16307