On Fri, 18 Feb 2005 04:19:34 GMT, Bob II <here@there.tv> reverently
intoned upon the aether:
[color=blue]
> Hey, I've never used PHP before. I was wondering if it is possible to use
> PHP to generate web stats. My web host's stats aren't very good. So I
> want to generate some custom stats for myself.
>
> At a minimum, I want a log of the IP, referrer, environment variables, time
> stamp, etc., and dump it into a comma delimited text file that I can import
> into access or Excel. I don't need to generate gifs with PHP. Just need
> the raw data.
>
> Can PHP do this? My current understanding of PHP is that it is an embedded
> language. I was hoping to execute a server-side script without having any
> code embedded into the webpage. Maybe I could link to a PHP file?
>
> I am currently using Go Daddy hosting--the $3.95/month package. It's nice
> and cheap, but the stats aren't very good. I just basically want some raw
> info that I can import and analyze as I need. I don't get raw data. Just
> summaries.
>
> With my package, Perl, CGI, and other tools are not available to me. I
> only have the use of PHP.
>
> So, any ideas of what I can do to generate some web stats? Any tutorials?
> Free code? I've been looking, and I'm not finding a whole lot of newbie
> info in this area.
>
> Thanks.[/color]
Create a demo page and add the following:
<pre>
<?php
print_r($GLOBALS);
?>
</pre>
This will print everything you have available to you ($_SERVER, $_ENV,
$_GET, and etcetera are in $GLOBALS). Now if you want to go past
that, then you will need to use client side JavaScript or something
similar to pass to you some additional values (client screen
resolution, and other such). But much of what you can get from
Javascript really only has value in aggregate anyway (statistics from
small samples are rarely representative).
Anyway, $GLOBALS and MySQL will get you started.
have fun,
Sean
"In the End, we will remember not the words of our enemies,
but the silence of our friends."
- Martin Luther King Jr. (1929-1968)
Photo Archive @
http://www.tearnet.com/Sean
Last Updated 29 Sept. 2004