i am a newbie in PHP and i am trying to check the link to see if it is broken or not. If it is broken i am going to display a message saying it is broken if it is not i am going to display the link.
if(!($phpnet = fopen ($url, "r"))) {
//custom message goes here
echo "Sorry the link is broken"; }
else {
echo("<a href=\"" . $url . "\">Site Name</a>");
}
but when link is broken i get
Warning: fopen("$url","r") - Success in /home/ddddd/public_html/link.php on line 47
Sorry the link is broken
i just want to display the second part
how can i do that
or is there another way of checking the link
thanks in advance