Possible Duplicate:
what is the best way to check if a Url exists in PHP ?`
I'm looking for a function that returns TRUE
or FALSE
in php, either the URL is valid or not.
isValidURL($url);
I think that simple... That would take into count all kind of URL possible.
By valid I want it to refer to an existing page of the web or other kind of files. It just should exist.
Technically Duplicate Pages Issue means that a particular URL is technically identical to at least one other URL that the search engine has indexed. It can include URLs that are case-sensitive or have the same parameters in a different order.
To find details of specific URLs with technical duplicates, click on the blue URL Details button from the URL List. The URL Details tab will slide across, and you then need to navigate to Duplicate Content -> URLs, and you'll see all the duplicate URLs underneath.
Duplicate content confuses Google and forces the search engine to choose which of the identical pages it should rank in the top results. Regardless of who produced the content, there is a high possibility that the original page will not be the one chosen for the top search results.
<?php
$url = "http://stack*overflow.org";
if(filter_var($url, FILTER_VALIDATE_URL) === FALSE)
{
echo "Not valid";
}else{
echo "VALID";
}
?>
this does not check tlds though
You can check whether URL is valid or not using parse_url
function which would return false
if URL is not valid and an array
otherwise.
function isValidURL($url) { return (bool)parse_url($url); }
pretty easy way, huh? :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With