<p>I would like to be able to detect what country a visitor is from on my website, using PHP. </p>

<p>Please note that I'm not trying to use this as a security measure or for anything important, just changing the spelling of some words <em>(Americans seems to believe that the word "enrolment" has 2 Ls.... crazy yanks)</em>, and perhaps to give a default option in a "Select your country" list.</p>

<p>As such, using a Geolocation database is a tad over-the-top and I really don't want to muck about with installing new PHP libraries just for this, so <strong>what's the easiest/simplest way to find what country a visitor is from?</strong></p>

You can do some IP comparaison
without
having a whole library to do it.
Solution #1
Use an API, this way nothing is needed from your side. This is a web API that let you know the country:
```
```
Example: http://api.hostip.info/get_html.php?ip=12.215.42.19
 Return : Country: UNITED STATES (US)
```
```
Solution #2
But, Have you think to use the browser agent language? You might be able to know the type of english from it.
Solution #3
This website called
BlockCountry
let you have a list of IP by country. Of course, you do not want to block, but you can use the list of IP and compare them (get all US IP...) this might not be accurate...