This code is intended for websites that have geoblocked web streams and must display content based on the country of the IP address:
<?php
if ($_SERVER['HTTP_X_FORWARD_FOR']) {$ip = $_SERVER['HTTP_X_FORWARD_FOR'];}
else {$ip = $_SERVER['REMOTE_ADDR'];}
$url = "http://api.hostip.info/country.php?ip=".$ip;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$country = curl_exec($ch);
curl_close ($ch);
if($country == "US")
{
echo("We're sorry, the station is not available in the USA");
}
else
{
echo("
//the code to your player - remember to escape out of quotation marks (such as \" )
");
}
?>
