[geeklog-devtalk] PHP/CGI Question

Steve Sloan steve at finagle.org
Fri Apr 2 00:18:35 EST 2004


Hey guys, hope you don't mind a slightly OT question. I'm working on a plugin
to do music distribution for my band web page. The "fetch" script is fairly
simple, and just spits out the appropriate headers (streaming vs. download,
content type, etc.) and the dumps the song data (with readfile). At the end,
I have it update per-song and per-format hit counters, so I can see exactly
how unpopular we are.

My problem is that, if the transfer doesn't complete, the hit counters still
get updated. I'd like some way to detect if the connection is closed.
Normally, IIRC, in CGI apps this is indicated by a closing of stdout, and an
error write. My PHP script, though, behaves as if the transfer completes
immediately. I've tried several other methods -- passthru(), read()/write()
-- and they all behave the same. Any ideas?

Thanks ...

--Steve



More information about the geeklog-devtalk mailing list