1. Go to this page and download the library: Download j3j5/twitterapio library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$twitter_settings = array(
'consumer_key' => 'YOUR_CONSUMER_KEY',
'consumer_secret' => 'YOUR_CONSUMER_SECRET',
'token' => 'A_USER_TOKEN',
'secret' => 'A_USER_TOKEN_SECRET',
);
$api = new TwitterApio($twitter_settings);
// Now you can do all type of requests
$credentials = $api->get('account/verify_credentials');
$tweet = $api->post('statuses/update', array('status' => 'Testing TwitterApio!!!'));
$username = "masaenfurecida";
$tweets = array();
// getTimeline() can be used with any endpoint that returns a timeline (like statuses/mentions_timeline, statuses/home_timeline)
foreach($api->getTimeline('statuses/user_timeline', array('screen_name' => $username, 'count' => 200)) as $page) {
if(is_array($page) ) {
$tweets = array_merge($tweets, $page);
}
}
$followers = array();
foreach($api->getFollowers(array('screen_name' => $username, 'count' => 5000)) as $page) {
if(is_array($page) ) {
$followers = array_merge($followers, $page);
}
}
$friends = array();
foreach($api->getFriends(array('screen_name' => $username, 'count' => 5000)) as $page) {
if(is_array($page) ) {
$friends = array_merge($friends, $page);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.