As far as I understand, I am watching accounts of people who have
granted access to my application.
I just tried userstream-simple.php and noticed two things:
1. A minor bug:
Notice: Undefined variable: sz in ... line 38
2. I get the list of friends, but then I get:
Array
(
[errors] => Array
(
[0] => Array
(
[code] => WAR400
[message] => Http request illformed, some data ignored
)
)
)
I've not seen that before. At first glance it looks like something has
changed on the twitter side (I may not have run that test script since
Oct '11); perhaps phirehose relies on something that was undocumented
that they've now stopped doing. I'll do a bit more investigation now.
But, if the same problem you have, why don't you see that same error
message? Do you php.ini settings send everything to the log files and to
stdout/stderr? I suggest setting up a php.ini for the cli version, and
have startup and normal error messages go to stderr instead of the log
file (*).
Darren
*: Definitely for development machines; it is also my preference for
production machines. However, never do this for production machines for
a web-site.
--
Darren Cook, Software Researcher/Developer
http://dcook.org/work/ (About me and my work)
http://dcook.org/blogs.html (My blogs and articles)
> I just tried userstream-simple.php and noticed two things:
>
> 1. A minor bug:
> Notice: Undefined variable: sz in ... line 38
Fixed in a Dec 11th update. (And, no, that wasn't what $sz was doing; it
was supposed to be the running total of all bytes received in that
session. But the fixed version is fine too.)
> [code] => WAR400
> [message] => Http request illformed, some data ignored
I don't get this any more. Either it was coincidence or fixed in the one
of the three changes [1] to UserstreamPhirehose.php that I just updated to.
Darren
[1]:
Tue Nov 29 23:14:27 2011 -0800:
FIX: get UserstreamPhirehose class working again (replace use of
TCP_BACKOFF and HTTP_BACKOFF with the class members)
Thu Dec 1 11:29:39 2011 +1100
Fixed inconsistent code, indentation and other cleanups.
Fixed inconsistent braces, mixed indentation, invalid comment chars (#is
not valid for PHP);
Switched raw var_dump to proper log output;
Other minor cleanups;
Sat Dec 10 17:46:26 2011 -0800:
Missing USER_AGENT class constant in UserstreamPhirehose
[1] shows the initial output for me.
It was doing nothing, so I logged in to twitter.com, and followed a more
active user, and then I did a test tweet, and then the new user gave a
tweet [2]. Later, I deleted my test tweet and saw [3].
I hope that helps. It shows you can still log in to twitter.com while
connected to a user stream, and can do follow/tweet/delete commands that
you should see reflected in your userstream immediately.
Darren
[1]
Phirehose: Connecting to twitter stream:
https://userstream.twitter.com/2/user.json with params: array (
'delimited' => 'length',)
Phirehose: Resolved host userstream.twitter.com to 199.59.148.139
Phirehose: Connecting to 199.59.148.139
Phirehose: Connection established to 199.59.148.139
Phirehose: DEBUG:
'POST&https%3A%2F%2Fuserstream.twitter.com%2F2%2Fuser.json&delimited%3Dlength%26oauth_consumer_key%3D########%26oauth_nonce%3D########%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1327023222%26oauth_token%3D########%26oauth_version%3D1.0'
Phirehose: POST /2/user.json HTTP/1.0
Phirehose: Host: userstream.twitter.com:443
Phirehose: Content-type: application/x-www-form-urlencoded
Phirehose: Content-length: 16
Phirehose: User-Agent: Phirehose (https://github.com/fennb/phirehose)
Phirehose: Authorization: OAuth
realm="https://userstream.twitter.com/2/user.json",
oauth_consumer_key="#########", oauth_token="######",
oauth_nonce="#######", oauth_timestamp="1327023222",
oauth_signature_method="HMAC-SHA1", oauth_version="1.0",
oauth_signature="#####"
Phirehose:
Phirehose: delimited=length
Phirehose:
2012-01-20 10:33:42 (149):Array
(
[friends] => Array
(
[0] => 1234
....
[13] => 1234
)
)
Phirehose: Consume rate: 0 status/sec (1 total), avg enqueueStatus():
3.31ms, avg checkFilterPredicates(): 0ms (0 total) over 60 seconds, max
stream idle period: 30 seconds.
Phirehose: Consume rate: 0 status/sec (0 total), avg enqueueStatus():
0ms, avg checkFilterPredicates(): 0ms (0 total) over 60 seconds, max
stream idle period: 30 seconds.
...
[2]:
2012-01-20 10:43:55 (2764):Array
(
[target] => Array
(
[lang] => en
[geo_enabled] =>
...
)
[event] => follow
[created_at] => Fri Jan 20 01:43:48 +0000 2012
[source] => Array
(
[lang] => en
[geo_enabled] =>
)
)
2012-01-20 10:44:34 (1844):Array
(
[retweet_count] => 0
[favorited] =>
[text] => This is my test tweet, please ignore
[in_reply_to_status_id_str] =>
...
[in_reply_to_status_id] =>
)
Phirehose: Consume rate: 0 status/sec (2 total), avg enqueueStatus():
0.27ms, avg checkFilterPredicates(): 0ms (0 total) over 82 seconds, max
stream idle period: 25 seconds.
2012-01-20 10:45:10 (2226):Array
(
[retweet_count] => 0
[favorited] =>
[text] => Australia 4Q Import Price Index (QoQ) 2.5%
http://t.co/IDiqfZ0y #forex #trading
[in_reply_to_status_id_str] =>
...
[3]
2012-01-20 10:59:15 (125):Array
(
[delete] => Array
(
[status] => Array
(
[user_id_str] => 239273333
[id_str] => 160175827634503680
[id] => 160175827634503680
[user_id] => 239273333
)
)
)