<?php ini_set('display_startup_errors', 1); ini_set('display_errors', 1); error_reporting(-1); include_once 'head.php'; $ig = new instagram(); if (isset($_GET['location'])) { $loc = $_GET['location']; $geo = get_lat_lang($loc); $ig->get_media_by_location($geo); } else { ?> <script> $(document).ready(function(){ $('#search').addClass('open'); $('#search > form > input[type="search"]').focus(); }); </script> <?php } include_once 'footer.php';
<?php include_once 'head.php'; $location_url = "https://freegeoip.net/json/" . $_SERVER['HTTP_X_FORWARDED_FOR']; $location_json = file_get_contents($location_url); $location_array = json_decode($location_json, true); echo '<div class="well col-md-12 text-center"><p>We have detected your location to be ' . $location_array['city'] . ', ' . $location_array['region_name'] . ', ' . $location_array['country_name'] . '.</p></div>'; $ig = new instagram(); $ig->get_media_by_location(get_lat_lang($location_array['city'])); include_once 'footer.php';