On Friday 08 October 2004 21:33, Danny Sauer wrote:
Leendert wrote regarding 'Re: [SLE] Down load count?' on Fri, Oct 08 at 12:59:
On Friday 08 October 2004 17:19, James Hatridge wrote:
I plan on putting a PDF file on my web site for free down load. I would like to be able to know how many people look at it. How would you guys handle it?
A very simple form would be:
grep /var/log/apache2/access_log "\"GET /server_path_to_pdf" | wc --lines
(adjust directories and filenames to your own situation)
Of course I presume you have access to your webserver logs. ;)
"grep -c" will print the number of lines matched without piping through wc. :)
grep -c /var/log/apache2/access_log "GET /url/to/file.pdf" or egrep -c /var/log/apache2/access_log "GET .*/file.pdf"
If you don't have log/server access beyond a file, you could write a CGI script (or similar) that makes an entry in a file, send you an email, puts somethign in a database, etc. Link to the CGI script, and have the CGI generate a redirect to the actual PDF. If someone finds the direct URL, they won't be counted, but you'll get a count of everyone who goes through the CGI.
You can serve a stream of bytes through a php script. If the 'Content-Type' header is right, the other site will believe it is a .pdf file (or so). But boy, I hate those scripts. ;) I'd rather have a straight url of that .pdf file instead of having it served through a script. ;) Cheers, Leen