Check whether url contains http:// or https://
URL you can use parse_url(), which will return the URL components in an associative array
$strUrl = "http://www.google.com?query_string=10#fragment";
$strUrl = $websiteLink;
$arrParsedUrl = parse_url($strUrl);
p($arrParsedUrl);
if (!empty($arrParsedUrl['scheme']))
{
// Contains http:// schema
if ($arrParsedUrl['scheme'] === "http"){
}
// Contains https:// schema
else if ($arrParsedUrl['scheme'] === "https"){
}
}
// Don't contains http:// or https://
else{
}
URL you can use parse_url(), which will return the URL components in an associative array
$strUrl = "http://www.google.com?query_string=10#fragment";
$strUrl = $websiteLink;
$arrParsedUrl = parse_url($strUrl);
p($arrParsedUrl);
if (!empty($arrParsedUrl['scheme']))
{
// Contains http:// schema
if ($arrParsedUrl['scheme'] === "http"){
}
// Contains https:// schema
else if ($arrParsedUrl['scheme'] === "https"){
}
}
// Don't contains http:// or https://
else{
}
No comments:
Post a Comment