Is it possible to get a user's twitter feed (not their own posts, but the posts they would see if they were to view all the people they follow)?
I used the code from here:
Simplest PHP example for retrieving user_timeline with Twitter API version 1.1
But all I get is my own twitter feed, no matter what $twitterid is passed in.
function getFeed($twitterid)
{
$url = "https://api.twitter.com/1.1/statuses/home_timeline.json";
$oauth_access_token = "XXXX";
$oauth_access_token_secret = "XXXX";
$consumer_key = "XXX";
$consumer_secret = "XXX";
$oauth = array( 'screen_name' => $twitterid,
'count' => 3,
'oauth_consumer_key' => $consumer_key,
'oauth_nonce' => time(),
'oauth_signature_method' => 'HMAC-SHA1',
'oauth_token' => $oauth_access_token,
'oauth_timestamp' => time(),
'oauth_version' => '1.0');
$base_info = $this->buildBaseString($url, 'GET', $oauth);
$composite_key = rawurlencode($consumer_secret) . '&' . rawurlencode($oauth_access_token_secret);
$oauth_signature = base64_encode(hash_hmac('sha1', $base_info, $composite_key, true));
$oauth['oauth_signature'] = $oauth_signature;
// Make requests
$header = array($this->buildAuthorizationHeader($oauth), 'Expect:');
$options = array( CURLOPT_HTTPHEADER => $header,
//CURLOPT_POSTFIELDS => $postfields,
CURLOPT_HEADER => false,
CURLOPT_URL => $url . '?screen_name='. $twitterid.'&count=3',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false);
$feed = curl_init();
curl_setopt_array($feed, $options);
$json = curl_exec($feed);
curl_close($feed);
return json_decode($json);
}