The Most Active and Friendliest
Affiliate Marketing Community Online!

“Adavice”/  “1Win

Script for in your (city name) (location)

nonss123

New Member
affiliate
How do you make it say on your landing page: we have this product in your (city name, or town)?

So stating your users location.

Thank you.
 
Use MaxMind GEO-City
Sort of like this
PHP:
require_once("geoip2.phar");
use GeoIp2\Database\Reader;
// City DB
$reader = new Reader('GeoLite2-City.mmdb');
$record = $reader->city($ip);
//$_SERVER['REMOTE_ADDR']);
// or for Country DB
// $reader = new Reader('/path/to/GeoLite2-Country.mmdb');
// $record = $reader->country($_SERVER['REMOTE_ADDR']);
print($record->country->isoCode . "\n");
//print($record->country->name . "\n");
//print($record->country->names['zh-CN'] . "\n");
//print($record->mostSpecificSubdivision->name . "\n");
print($record->mostSpecificSubdivision->isoCode . "\n");
print($record->city->name . "\n");

Or pay a service (tool) that will be slower ;)
 
Use MaxMind GEO-City
Sort of like this
PHP:
require_once("geoip2.phar");
use GeoIp2\Database\Reader;
// City DB
$reader = new Reader('GeoLite2-City.mmdb');
$record = $reader->city($ip);
//$_SERVER['REMOTE_ADDR']);
// or for Country DB
// $reader = new Reader('/path/to/GeoLite2-Country.mmdb');
// $record = $reader->country($_SERVER['REMOTE_ADDR']);
print($record->country->isoCode . "\n");
//print($record->country->name . "\n");
//print($record->country->names['zh-CN'] . "\n");
//print($record->mostSpecificSubdivision->name . "\n");
print($record->mostSpecificSubdivision->isoCode . "\n");
print($record->city->name . "\n");

Or pay a service (tool) that will be slower ;)

Thank you for helping me!

But how do insert it into index.html, so that it is on one line only etc
 
I just have my landing page and websites developer do it.

Farm it out and build a relationship with a developer you will continue to employ for such tasks.

We are not all as smart and capable as Graybeard in these matters, but if you truly want to learn it, he's the guy with the magic codes!
 
Thank you for helping me!

But how do insert it into index.html, so that it is on one line only etc
That is for a php page
you could with a ssi include in *.HTML with the server properly configured.
SSI-Developer.net - SSI Tutorials, Server Side Includes ssi is old-tech but works very fast in many situations. You can also set up Apache2 or Nginx to do this also.

GeoLite2 Free Downloadable Databases « MaxMind Developer Site
MaxMind has a javaScript too API

GeoIP2 JavaScript Client API « MaxMind Developer Site
 
Last edited:
Just use ipinfo. Here's and example for you:
HTML:
$.get("https://ipinfo.io", function(response) {
    console.log(response.city, response.country);
}, "jsonp");
 
MI
Back