I thought I had this figured out, but I'm running into an issue. I'm creating a URL blacklist in my application. I need to block all subdomains, directories, etc from an array of domains. Below is the array I have:
$blacklist = array(
'/\.google\./',
'/\.microsoft\./',
);
Here is where I'm checking:
$host = parse_url($url, PHP_URL_HOST);
$blackList = $GLOBALS['blacklist'];
foreach($blackList as $stop) {
if (preg_match($host === $stop)) {
die('blacklisted');
}
}
When I run this, it doesn't die as intended.