hi all
i'm trying to use fopen to check to see if a url entered is valid or not. here's the code i'm using to check the url
{
// check URL format
if (strstr($new_url, "http://")===false)
$new_url = "http://".$new_url;
// check URL is valid
if (@fopen($new_url, "r"))
{
// try to add bm
if (add_bm($new_url))
echo "Bookmark added.";
else
echo "Could not add bookmark.";
}
else
echo "Not a valid URL.";
}
i'm working through the lessons in php and mysql web development by welling and thomson. no matter what url i type in, i get the same msg: 'Not a valid URL.', so i'm guessing there's something wrong with the syntax in this if then statement. if anyone has any ideas, i'd really appreciate it.
thanks
p.