Phirehouse and twitter user streams + OAuth

431 views
Skip to first unread message

Kaspars Foigts

unread,
Oct 20, 2010, 6:05:33 AM10/20/10
to Phirehose Users
Hey,

Are there any plans on extending Phirehouse to work with userstreams
and oauth (currently in production on twitter) and sistestreams (which
will use oauth as well; currently in beta)?

--
Kaspars
http://laacz.lv/

Augusto Dias

unread,
Oct 20, 2010, 9:07:16 AM10/20/10
to Phirehose Users
Hi Kaspars,

About the OAuth the author said at Introduction page in a comment
"Comment by project member fenn.bailey, Aug 14, 2010
Hey Todd,

Basic Auth is only being disabled on the REST API, not streaming.

At the time the last version was written, there was no OAuth access to
the streaming API, but I see it now exists.

It will definitely be in the next version, cheers!"

and about User Strem is there a author's comment at this thread
http://groups.google.com/group/phirehose-users/browse_thread/thread/2d7e384662ba6eb

"Hey All,
Phirehose is definitely not (currently) intended to be used for User
Streams. In fact, I believe the current version was released before
User
Streams beta was even announced :)
OAuth + User Streams is probably the most requested two features, and
is
definitely something I'm planning on implementing. It does (as shown
above)
require some fairly significant changes to the client though.
Cheers,
Fenn. "

:)

Jonathon Hill

unread,
Oct 20, 2010, 10:05:54 AM10/20/10
to phireho...@googlegroups.com
On Wed, 20 Oct 2010 06:05:33 -0400, Kaspars Foigts <la...@laacz.lv> wrote:

> Hey,
>
> Are there any plans on extending Phirehouse to work with userstreams

> and oauth (currently in production on twitter) and sitestreams (which


> will use oauth as well; currently in beta)?
>
> --
> Kaspars
> http://laacz.lv/
>


Kaspar, I am currently using a modified and extended version of Phirehose for consuming a user stream. It required a small modification to the base Phirehose script (v0.2.4) to fix a bug reading the user stream. The attached UserstreamPhirehose.php script should do the trick for you.

Fenn, would you mind adding the Phirehose.diff changes to the next version? Also, perhaps you would consider including UserstreamPhirehose.php in your base package.

Thanks!


Jonathon Hill
http://rainmakerapp.com

Phirehose.diff
UserstreamPhirehose.php

Fenn Bailey

unread,
Oct 20, 2010, 7:44:29 PM10/20/10
to phireho...@googlegroups.com
Hey Jonathon - Nicely done with the UserStreams extension!

Though you've made me realise how hard I've made it to extend the class in ways other than what I'd intended :)

I'm starting to wish I'd hosted the project on GitHub so people could fork/modify it more easily.

Based on inspiration from your implementation, I may end up either unifying it into a single class or potentially a base class with subclasses for the different types of stream if they differ enough.

I'll put your extension on the Google Code page for others to use.

Cheers (and thanks for your work!),

  Fenn.

Jonathon Hill

unread,
Oct 20, 2010, 8:03:28 PM10/20/10
to phireho...@googlegroups.com
Thank you, Fenn!

Jonathon

On Wed, 20 Oct 2010 19:44:29 -0400, Fenn Bailey <fenn....@gmail.com> wrote:

> Hey Jonathon - Nicely done with the UserStreams extension!
>
> Though you've made me realise how hard I've made it to extend the class in
> ways other than what I'd intended :)
>
> I'm starting to wish I'd hosted the project on GitHub so people could
> fork/modify it more easily.
>
> Based on inspiration from your implementation, I may end up either unifying
> it into a single class or potentially a base class with subclasses for the
> different types of stream if they differ enough.
>
> I'll put your extension on the Google Code page for others to use.
>
> Cheers (and thanks for your work!),
>
> Fenn.
>
> On Thu, Oct 21, 2010 at 1:05 AM, Jonathon Hill <jona...@compwright.com>wrote:
>
>> On Wed, 20 Oct 2010 06:05:33 -0400, Kaspars Foigts <la...@laacz.lv> wrote:
>>
>> Hey,

<snip>

Kaspars Foigts

unread,
Oct 21, 2010, 1:25:03 AM10/21/10
to Phirehose Users
Thanks. I'll try this one soon and give some feedback. For now I'm
consuming userstream with my own script, so this patch could help me
switching to Phirehouse in near future.
>  Phirehose.diff
> 1KViewDownload
>
>  UserstreamPhirehose.php
> 26KViewDownload

Karthik Murugan

unread,
Nov 10, 2010, 7:36:46 AM11/10/10
to Phirehose Users
Thanks a lot, Jonathon. Its worked for me!!

For new users, just get familiar with Phirehose and for UserStreams,
you should something like the following:

define('TWITTER_CONSUMER_KEY', "Your app's consumer key");
define('TWITTER_CONSUMER_SECRET', "Your app's consumer secret");

$sc = new UserStreamConsumer("User's access token", "User's access
secret");
$sc->consume();


On Oct 21, 5:03 am, "Jonathon Hill" <jonat...@compwright.com> wrote:
> Thank you, Fenn!
>
> Jonathon
>
>
>
>
>
>
>
>
>
> On Wed, 20 Oct 2010 19:44:29 -0400, Fenn Bailey <fenn.bai...@gmail.com> wrote:
> > Hey Jonathon - Nicely done with the UserStreams extension!
>
> > Though you've made me realise how hard I've made it to extend the class in
> > ways other than what I'd intended :)
>
> > I'm starting to wish I'd hosted the project on GitHub so people could
> > fork/modify it more easily.
>
> > Based on inspiration from your implementation, I may end up either unifying
> > it into a single class or potentially a base class with subclasses for the
> > different types of stream if they differ enough.
>
> > I'll put your extension on the Google Code page for others to use.
>
> > Cheers (and thanks for your work!),
>
> >   Fenn.
>
> > On Thu, Oct 21, 2010 at 1:05 AM, Jonathon Hill <jonat...@compwright.com>wrote:
>
> >> On Wed, 20 Oct 2010 06:05:33 -0400, Kaspars Foigts <la...@laacz.lv> wrote:
>
> >>  Hey,
> <snip>
>
> >> Kaspar, I am currently using a modified and extended version of Phirehose
> >> for consuming auserstream. It required a small modification to the base
> >> Phirehose script (v0.2.4) to fix a bug reading theuserstream. The attached

Sebastian Hoitz

unread,
Dec 23, 2010, 10:15:47 AM12/23/10
to Phirehose Users
Hi!

How can I use this UserStreams + OAuth extension for the normal
Streaming API?

When I just change the URL and method, I get "Length required" errors
from the Twitter API.

When I comment out the corresponding line, so that the class also
sends the content length, I get UNAUTHORIZED errors.

What should I do?

Thanks,
Sebastian

Karthik Murugan

unread,
Dec 23, 2010, 10:20:42 AM12/23/10
to phireho...@googlegroups.com
I think, Streaming API supports only basic auth. I've been using Phirehose object with plain username/password and it works for me.

Sebastian Hoitz

unread,
Dec 23, 2010, 10:32:16 AM12/23/10
to Phirehose Users
But the UserStreams extension does support OAuth. However, this OAuth
support seems to be limited to the UserStreams API, as it is having
difficulties with the SiteStreams API.

On Dec 23, 4:20 pm, Karthik Murugan <kart...@yemkay.com> wrote:
> I think, Streaming API supports only basic auth. I've been using Phirehose
> object with plain username/password and it works for me.
>

Jonathon Hill

unread,
Dec 23, 2010, 10:35:43 AM12/23/10
to phireho...@googlegroups.com

No one as of yet has made a Phirehose extension for the Site Streams API afaik.

Jonathon Hill

Sebastian Hoitz

unread,
Dec 23, 2010, 10:40:38 AM12/23/10
to Phirehose Users
I wonder how much different the OAuth for SiteStreams would be to
UserStreams?

Shouldn't this actually be pretty much equal?

On Dec 23, 4:35 pm, Jonathon Hill <jhill9...@gmail.com> wrote:
> No one as of yet has made a Phirehose extension for the Site Streams API
> afaik.
>
> Jonathon Hill

Jonathon Hill

unread,
Dec 23, 2010, 2:30:13 PM12/23/10
to phireho...@googlegroups.com

They are similar, but they are not the same. It probably not take very much effort to support site streams.

Jonathon Hill

Sebastian Hoitz

unread,
Jan 2, 2011, 7:24:06 PM1/2/11
to Phirehose Users
I'm almost there now...

However, I ran into a problem: The Twitter API is sending me the
tweets with a Chunked Transfer-Encoding.

So I get something like this:

Hexadecimal number
Tweet Length
JSON Tweet

(Not sure, but this might be the same with the UserStreams OAuth
implementation?)

How would you dechunk those HTTP packets?
As far as I can see, the normal Streaming API doesn't do any of this -
so how come you get the correct tweets?

On Dec 23 2010, 8:30 pm, Jonathon Hill <jhill9...@gmail.com> wrote:
> They are similar, but they are not the same. It probably not take very much
> effort to support site streams.
>
> Jonathon Hill
Reply all
Reply to author
Forward
0 new messages