Question

Would it be possible to access the visitor county origin information from AwStats using PHP? A new feature I would like to add to a project lists the countries of of recent visitors (30 days).

Was it helpful?

Solution

What you need to do is find the country from the IP address in the Apache access log. This is the same log Awstats uses to generate its data.

  1. Use a class such as the one created by Eric Lamb to parse the Apache access log.
  2. In the same script, use a service like hostip to determine the country.
  3. Create a cron job to run the script every night at 2AM.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top