: Accessing server stats using PHP There are over 10 stats packages installed in my server (AWStat, Webalizer, etc) and cPanel has an interface to show them in terms of visitors, bandwidth, popular
There are over 10 stats packages installed in my server (AWStat, Webalizer, etc) and cPanel has an interface to show them in terms of visitors, bandwidth, popular pages, etc.
It is possible to access those stats through PHP?
Possible applications include getting a list of most popular content, reporting on visitors and taking actions depending on bandwidth, etc. I know that many of these features can be implemented by creating my own stats counting system but since that information is already somewhere, it could be awesome not to have to write more code to collect it.
More posts by @Shelley277
1 Comments
Sorted by latest first Latest Oldest Best
There's no official cPanel API to access detailed stats data. There are, however, a few scripted workarounds:
There's a reference to scripting cPanel access to scrape AWStats output with PHP here.
There are also GPL-licenced projects to access Apache/AWStats log data with PHP here (via log exporter) and here (via access panel). The log exporter looks like it might be the more useful of the two in your case.
There's some PHP code to display Webalizer stats without logging in to cPanel here and a method to make Webalizer stats public with htaccess here. (You'd then have to scrape data from the Webalizer html table, which is less than ideal.)
These solutions all feel a little hacked together, though. If you're building a custom control panel to display visitor stats, I'd suggest using Google Analytics with the official Analytics API, which provides read-only access to traffic data.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.