Unable to Authorize


#1

I am stuck. I feel like I researched the Oauth stuff pretty well, but I still receive a 401 unauthorized response. Can someone respond with some form of direction? Thanks.

<?php
ini_set(‘display_errors’, ‘On’);

$req_url = ‘https://api.twitter.com/oauth/request_token’;
$auth_url = ‘https://api.twitter.com/oauth/authorize’;
$acc_url = ‘https://api.twitter.com/oauth/access_token’;
$api_url = ‘https://api.twitter.com/1.1/’;
$consumer_key = ‘mysecret’;
$consumer_secret = ‘mysecret’;
$api_req = ‘https://api.twitter.com/1.1/statuses/home_timeline.json’;

try
{
$oauth = new Oauth($consumer_key, $consumer_secret, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_URI);
$oauth->enabledebug();
$request_token_info = $oauth->getRequestToken($req_url);

$oauth->setToken($request_token_info["oauth_token"], $request_token_info["oauth_token_secret"]);

$access_token_info = $oauth->getAccessToken($acc_url);
$oauth->setToken($access_token_info["oauth_token"], $access_token_info["oauth_token_secret"]);


$oauth->fetch($api_req);
success();

}
catch (OAuthException $E)
{
echo “

”;
print_r($E->debugInfo);
echo “

”;

}

?>

<?php function success() { echo "SUCCESS!
"; } ?>