Skip to content

Instantly share code, notes, and snippets.

@hexium310
Created December 24, 2017 14:13
Show Gist options
  • Save hexium310/6d19953f14e569d24ce85389a47d1906 to your computer and use it in GitHub Desktop.
Save hexium310/6d19953f14e569d24ce85389a47d1906 to your computer and use it in GitHub Desktop.
Substitute of User Streams by Public Streams
<?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