phploggingtrafficawstats

Access AWStats information from PHP?


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).


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.