Created
December 24, 2017 14:13
-
-
Save hexium310/6d19953f14e569d24ce85389a47d1906 to your computer and use it in GitHub Desktop.
Substitute of User Streams by Public Streams
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'vendor/autoload.php'; | |
use mpyw\Cowitter\Client; | |
$client = new Client([ | |
'CK', | |
'CS', | |
'AT', | |
'ATS' | |
]); | |
$ids = array_merge( | |
[$client->get('account/verify_credentials')->id], | |
$client->get('friends/ids')->ids | |
); | |
$client->streaming( | |
'statuses/filter', | |
function ($status) use ($ids) { | |
if (!isset($status->text) || !in_array($status->user->id_str, $ids)){ | |
return; | |
} | |
printf("%s(@%s) - %s\n", | |
$status->user->name, | |
$status->user->screen_name, | |
htmlspecialchars_decode($status->text, ENT_NOQUOTES) | |
); | |
}, | |
['follow' => implode(',', $ids)] | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment