@rampimp; buyrun hocam
<?php
header("Content-Type: text/plain; charset=UTF-8");
/**
* @see: https://github.com/imsaintx/utils/blob/master/src/Tools/Utils.php#L607
*/
function str_contains($haystack, $needle)
{
return (bool) strpos($haystack, $needle) !== false;
}
function getHoster($url)
{
$url = parse_url($url, PHP_URL_HOST);
if(str_contains($url, "google.com.tr"))
{
return "Google Türkiye";
}
else if(str_contains($url, "google.co.uk"))
{
return "Google UK";
}
else if(str_contains($url, "google.de"))
{
return "Google Deutschland";
}
else if(str_contains($url, "google.fr"))
{
return "Google France";
}
else if(str_contains($url, "google.ca"))
{
return "Google Canada";
}
else if(str_contains($url, "google.pl"))
{
return "Google Polska";
}
else if(str_contains($url, "google.com"))
{
return "Google";
}
else
{
return "Unknown hoster.";
}
}
$urls = [
"http://www.google.com/",
"http://www.google.com.tr/",
"http://www.google.de/",
"http://www.google.ca/",
"http://www.google.pl/",
"http://www.google.co.uk/"
];
foreach($urls as $url)
{
echo getHoster($url) . PHP_EOL;
}
/**
### ÇIKTI ###
Google
Google Türkiye
Google Deutschland
Google Canada
Google Polska
Google UK
**/