PHP $connection->http_code Takes 401 ın login


#1

Hi All,
My code
<?php

/* Start session and load library. */
session_start();
ob_start();
require_once(‘includes/twitteroauth/twitteroauth.php’);
require_once(‘includes/config.php’);

/* Build TwitterOAuth object with client credentials. */
$connections = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);

/* Get temporary credentials. */
$request_token = $connections->getRequestToken(“http://tivityonlendir.tk/callback.php”);

/* Save temporary credentials to session. */
$token = $request_token[‘oauth_token’];
$_SESSION[‘oauth_token’] = $token;
$_SESSION[‘oauth_token_secret’] = $request_token[‘oauth_token_secret’];

/* If last connection failed don’t display authorization link. /
switch ($connections->http_code) {
case 200:
/
Build authorize URL and redirect user to Twitter. /
$url = $connections->getAuthorizeURL($request_token[‘oauth_token’]);
?>

<?
break;
default:
/
Show notification if something went wrong. */
echo ‘Could not connect to Twitter. Refresh the page or try again later.
Uygulama Twitter a bağlanamıyor daha sonra tekrar deneyin.’;
echo ‘
’.OAUTH_CALLBACK.’
’;
echo CONSUMER_KEY.’
’;
echo CONSUMER_SECRET.’
’;
echo $token.’
’;
echo $connections->http_code.’
’;
echo $request_token[‘oauth_token’] ;
//echo’ ';
}

?>

This code For login with twitter but Request Token func not working on my api
I need http code 200 to access but gives me 401 Can any body help me?

Thanks…