Check whether url contains http:// or https://
if your string is a 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