Jump to content

Twitter Help


JohnOP

Recommended Posts

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.