title: PHP Geo Location
body: <p>Hi my php code seems a bit hit and miss. The below <code>if($location !== "AU"){</code> conditional was working last week but now it does not. Wondering if the ipinfo service is not that stable? I am currently in the AU and I do not want it to display.
  Any help? </p>
  
  <pre><code>&lt;?php
  $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
  $details = json_decode(file_get_contents("http://ipinfo.io/{$ip}/json"));
  $location = $details-&gt;country;
  if($location !== "AU"){
      if(is_page(array('industrial-hoses', 'industrial-clamps', 'industrial- 
      adaptors', 'rubber-industrial-hoses', 'industrial-couplings', 'industrial- 
      accessories', 'industrial-hose-rubber-air', 'rubber-air-water-industrial-hose', 
      'rubber-chemical-acid-industrial-hose', 'rubber-food-beverage-industrial-hose',  
      'rubber-fuel-oil-industrial-hose', 'rubber-material-handling-industrial-hose', 
      'rubber-multi-purpose-industrial-hose' ,'rubber-specialty-industrial-hose', 
      'pvc-industrial-hoses', 'pvc-air-water-industrial-hose', 'pvc-chemical-acid- 
      industrial-hose', 'pvc-food-beverage-industrial-hose', 'pvc-fuel-oil- 
      industrial-hose', 'pvc-material-handling-industrial-hose', 'pvc-multi-purpose- 
      industrial-hose', 'pvc-speciality-industrial-hose', 'teflon-speciality- 
      industrial-hose', 'flexible-ducting-speciality-industrial-hose'))){
          echo '&lt;script src="https://website.com/f/embed.php?id=7" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;';
      }
      }
  ?&gt;
  </code></pre>