Cannot retrieve friends ids


#1

hi i have this code below:

$twitterObj = new EpiTwitter($consumer_key, $consumer_secret);
$twitterObj->setToken($_SESSION['ot'], $_SESSION['ots']);
$twitterFriends=$twitterObj->get_friendsIds(array('screen_name' => 'himanshujaju'));
$twitterFriends->response;
echo $twitterFriends->responseText;
foreach($twitterFriends as $friend) { echo $friend->id; }

this alwasys shows response as {“errors”:[{“code”:37,“message”:“Not authorized to use this endpoint”}]}

i am using epitwitter classes…any code suggestion?


#2

That’s a generic access denied message. How are you populating $_SESSION[‘ot’] and $_SESSION[‘ots’] ?


#3

session variables are fine because i can post a new tweet and get user info as well…


#4

It’s likely that your library is calling the wrong end point.

https://twitter.com/friends/ids.json is no longer a valid resource, nor is https://twitter.com/1/friends/ids.json – only https://api.twitter.com/1/friends/ids.json and https://api.twittter.com/1/friends/ids.xml are valid URLs for this API.


#5

thank you very very much…!! can you tell any good new library for php??


#6

Yes, tmhOAuth is very lightweight: https://github.com/themattharris/tmhOAuth

And @abraham’s twitteroauth is fantastic: https://github.com/abraham/twitteroauth


#7

hi dude i m here