PHP: function of url exists

center

Check if a URL exists.

function url_exists($url) {

//in this case: check if url contents is not null then return 1
if(@file_get_contents($url,0,
<div id=":10w">NULL,0,1))
{
echo "Url exists";
}
else
{
echo "Url does not exist";
}
}

EXAMPLE:
$url_here = ‘http://www.google.com
url_exists($url_here);

it prints-> Url exists.

Thank you!

  • Share/Bookmark



Post a Comment

You must be logged in to post a comment.