When I create a URL to a specific Amazon product, the URL needs to include the proper Amazon site specific to the visitor's country.
So I need to geocode the visitors location, then map that geocode to the proper Amazon store.
I suspect that I am not the first to need this. There are universal URL generator sites, but I don't want to use their domains in the URL - and I want to include my affiliate code, not theirs.
So, looking for code that I can modify to map a visitor's geolocation to the proper Amazon store. The code should figure out the proper Amazon URL for the visitor's country (like amazon.ca or amazon.de, etc).
Looking for server-side code so I don't have to worry about ad-blocking; PHP language preferred.