Skip to content

Instantly share code, notes, and snippets.

@cawa87
Created September 5, 2014 06:47
Show Gist options
  • Save cawa87/19e4c7c94e258d812f33 to your computer and use it in GitHub Desktop.
Save cawa87/19e4c7c94e258d812f33 to your computer and use it in GitHub Desktop.
Lastest tweets
<?php
$consumerKey = '--------------------';
$consumerSecret = '----------------------';
$accessToken = '-------------------------------------';
$accessTokenSecret = '-----------------------------';
$twitter = new \TwitterPhp\RestApi($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret);
/*
* Connect as application
* https://dev.twitter.com/docs/auth/application-only-auth
*/
$connection = $twitter->connectAsApplication();
/*
* Collection of the most recent Tweets posted by the user indicated by the screen_name, without replies
* https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline
*/
$lastest = $connection->get('/statuses/user_timeline', array('screen_name' => 'CawaKharkov', 'exclude_replies' => 'true', 'count' => 2));
return ['lastestTweets' => $lastest];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment