James Bachini

Combining Maxmind GeoIP with Google Maps iFrame

This is a quick script which uses Maxminds geoip location db downloadable for free from here with Google Maps iFrame. I haven’t tested this enough to find out if Google restrict the number of requests by referrer but you could always put a meta refresh page in the iframe to blank the referrer if thats a problem.

// you might have to change the first three lines
$gpath = getcwd() . "/geoip/GeoIPCity.dat"; // to where your db is
include("geoip/geoipcity.inc");  // to where your .inc file is
$gi = geoip_open($gpath,GEOIP_STANDARD);
$record = geoip_record_by_addr($gi,$myip);
$city = $record->city;
$lat = $record->latitude;
$long = $record->longitude;
$countrycode = $record->country_code;
<iframe frameborder="0" marginwidth="0" marginheight="0" border="0" style="border:0; margin:0; width:340px; height:200px; -moz-border-radius: 15px; border-radius: 15px; border:3px solid #F00;" src="http://www.google.com/uds/modules/elements/mapselement/iframe.html?maptype=hybrid&amp;latlng=<?php echo $lat; ?>%2C<?php echo $long; ?>" scrolling="no" allowtransparency="true"></iframe>

Get The Blockchain Sector Newsletter, binge the YouTube channel and connect with me on Twitter

The Blockchain Sector newsletter goes out a few times a month when there is breaking news or interesting developments to discuss. All the content I produce is free, if you’d like to help please share this content on social media.

Thank you.

James Bachini

Disclaimer: Not a financial advisor, not financial advice. The content I create is to document my journey and for educational and entertainment purposes only. It is not under any circumstances investment advice. I am not an investment or trading professional and am learning myself while still making plenty of mistakes along the way. Any code published is experimental and not production ready to be used for financial transactions. Do your own research and do not play with funds you do not want to lose.