Thanks for the heads-up Karthik! It appears Phirehose does not send a
Accept-Encoding header; so nothing should break.
But, how to add support for gzip to phirehose? This seems to depend on
if each tweet will be gzipped individually, or the whole stream.
If the former it should be quite easy. Just before this line:
$this->enqueueStatus($this->buff);
we would do:
if($this->usingGzip)$this->buff=gzdecode($this->buff);
But if the whole stream is gzipped, how does it work? Doesn't it need to
know what has come before, in order to be able to decode what has come
after? (*)
Well, PHP has gzopen() (http://php.net/gzopen). The comments in the PHP
manual page show a daisy-chain example:
$fp = fopen("compress.zlib://http://some.website.org/example.gz", "r");
But Phirehose uses fsockopen. Can that also cope with daisy-chaining
schemes? E.g. would this work?
$scheme = "compress.zlib://ssl://";
Darren
*: A couple of StackOverflow questions that didn't really answer this
for me:
http://stackoverflow.com/questions/3469040/decoding-gzip-using-php-sockets
http://stackoverflow.com/questions/8395705/how-to-decompress-gzip-stream-chunk-by-chunk-using-php
--
Darren Cook, Software Researcher/Developer
http://dcook.org/work/ (About me and my work)
http://dcook.org/blogs.html (My blogs and articles)
When you (or someone) has time I'd love to see this done. Not least
because the curl multi_* functions are practically undocumented, and in
my experiences so far, are hard to get working.
(Or phrased more directly: show me the money Fenn!)
You'd only need an abstraction layer if you think you might want to
> It would, however, be slightly messy to support both curl AND fsockopen at
> the same time (you'd need an additional layer of abstraction).
introduce a 3rd approach in the future (*). With just two options, using
if/else clauses wrapped round the three blocks of code you identified works.
*: Or if you write in java... from what I've seen enterprise java
programmers like to wrap an abstraction layer around everything, even if
there will only ever be a single approach ;-)