JohnOP Posted November 19, 2011 Share Posted November 19, 2011 I'm looking for some help from someone who has used the Twitter API, basically i just want to check if i follow a certain user, i have the code set p to log in to my website and auth the user etc i just cant get the check to work correctly. if(isset($_GET['oauth_token']) || (isset($_COOKIE['oauth_token']) && isset($_COOKIE['oauth_token_secret']))) { // user accepted access if( !isset($_COOKIE['oauth_token']) || !isset($_COOKIE['oauth_token_secret']) ) { // user comes from twitter $Twitter->setToken($_GET['oauth_token']); $token = $Twitter->getAccessToken(); setcookie('oauth_token', $token->oauth_token); setcookie('oauth_token_secret', $token->oauth_token_secret); $Twitter->setToken($token->oauth_token, $token->oauth_token_secret); } else { // user switched pages and came back or got here directly, stilled logged in $Twitter->setToken($_COOKIE['oauth_token'],$_COOKIE['oauth_token_secret']); } $user= $Twitter->get_accountVerify_credentials(); echo " <p> Logged in to Twitter as: <strong>{$user->screen_name}</strong><br /> </p>"; //check if i follow someone $follows = $Twitter->get('friendships/exists', array('user_a' => $_SESSION['username'], 'user_b' => 'USERB')); if($follows){ echo 'You are following USERB '; } } I've tried a few different ways but can't seem to get this working. Quote Link to comment https://forums.phpfreaks.com/topic/251441-twitter-help/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.