A simple PHP script for routing by country

This code is intended for websites that have geoblocked web streams and must display content based on the country of the IP address:

    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");
                //the code to your player - remember to escape out of quotation marks (such as \" )