1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php
- class TwitterSiteStream extends TwitterStreamReader
- {
- protected $userIds;
- public function __construct(TwitterOAuthClient $auth, $baseUrl='https://sitestream.twitter.com')
- {
- parent::__construct($auth, $baseUrl);
- }
- public function connect($method='2b/site.json')
- {
- $params = array();
- if ($this->userIds) {
- $params['follow'] = implode(',', $this->userIds);
- }
- return parent::connect($method, $params);
- }
-
- function followUsers($userIds)
- {
- $this->userIds = $userIds;
- }
-
- function routeMessage(stdClass $data)
- {
- $context = array(
- 'source' => 'sitestream',
- 'for_user' => $data->for_user
- );
- parent::handleMessage($data->message, $context);
- }
- }
|