Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php check if link exists

function check_link_existency($url) {

  // Use get_headers() function
    $headers = @get_headers($url);

    // Use condition to check the existence of URL
    if ($headers && strpos($headers[0], '200')) {
        echo "URL Exist";
        return true;
    } else {
        echo "URL Doesn't Exist";
        return false;
    }
}
 
PREVIOUS NEXT
Tagged: #php #check #link #exists
ADD COMMENT
Topic
Name
5+7 =