/** * Fetch recent mentions from our main account (currently hard-coded) * Included so our backend could offer ability to reply to users * @param integer $limit limit the requested tweets to this amount (use this! saves lots of b/w) * @return array hash of content from the Twitter API. */ function getRecentMentions($limit = 8) { global $twitterKeys; $twit = new TwitterAPIExchange($twitterKeys); $resource = 'https://api.twitter.com/1.1/statuses/mentions_timeline.json'; $fields = array('count' => $limit, 'trim_user' => true); $result = $twit->setGetfields($fields)->buildOauth($resource, 'GET')->performRequest(); // TODO error handling return json_decode($result, true); }