Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Chuck Anderson
October 11, 2005, 9:25 pm
rate this thread
an Apache access log file and inserts new entries into a database.. The
only way I can access these log files is through a cPanel URL that
delivers a gzipped copy of the log file with all entires for the current
month (up to the current date and time).
I want to run this script once a day (at night) and would like to
download the gzipped file by resuming from where I left off the day
before (instead of always downloading the entire gzipped file).
I have tried using CURL with the option - curl_setopt($ch,
CURLOPT_RESUME_FROM, $prev_offset) - but that always restarts the
download from the beginning. ($prev_offset is the previous days file size).
I'm not sure what the structure of a gzip file is, so I don't even know
if it is possible to resume a gzip file download when the file has been
rebuilt in the mean time (cPanel creates a gzipped file with the same
name from the raw log files every time you access that page in cPanel).
My guess is that this is probably not possible. ... But .... I am
trying to make the resume work to find out for myself and I can not make
the resume work.
The bottom line is that I am trying to avoid downloading the entire
gzipped log file every time I need to download it.
As an alternate, I have been successful using gzopen, and then I can
gzseek to the previous offset, but I am unable to use a secure URL
(https) with the Zlib functions (gzopen) with my Windows version of Php
(the username and password have to be included in the cPanel URL to
access the log file, so I'd like to use SSL.)
(I have started another thread to figure out how to get a Php Windows
binary with https and ftps as registered streams (built with
--with-openssl in the ./configure command), but so far I have gotten no
Question: When using gzread, where does the decompression take place -
on the server where the file is located, or on my PC after the
compressed data is downloaded? Does gzseek work on a compressed file,
or must it be uncompressed on the server first? The point being; when I
use gzopen and gzread, am I downloading compressed or uncompressed data
from the server where the log files are located?
I can use either method, but want to meet two requirements.
1. I do not want to download redundant (old) data every day (I want to
resume where I left off)
... and ...
2. I want to send the request for the log file (containing a username
and password) using SSL.
I would appreciate any help or insight.
Chuck Anderson • Boulder, CO
Integrity is obvious.
The lack of it is common.