Advertisement
Corey

Untitled

May 17th, 2020
796
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.39 KB | None | 0 0
  1. <?php
  2.     function getCountry()
  3.     {
  4.         if(isset($_SERVER["GEOIP_COUNTRY_NAME"]))
  5.         {
  6.             $country = $_SERVER["GEOIP_COUNTRY_NAME"];
  7.         }
  8.         elseif(isset($_SERVER["GEOIP_COUNTRY_CODE"]))
  9.         {
  10.             $country = $_SERVER["GEOIP_COUNTRY_CODE"];
  11.         }
  12.         elseif(isset($_SERVER["HTTP_CF_IPCOUNTRY"]))
  13.         {
  14.             $country = $_SERVER["HTTP_CF_IPCOUNTRY"];
  15.         }
  16.         return $country;
  17.     }
  18.  
  19.     $country = getCountry();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement