enableDebug(); if(!isset($_GET['oauth_token']) && !$_SESSION['state']) { $request_token_info = $oauth->getRequestToken($req_url); $_SESSION['secret'] = $request_token_info['oauth_token_secret']; $_SESSION['state'] = 1; header('Location: '.$authurl.'?oauth_token='.$request_token_info['oauth_token']); exit; } else if($_SESSION['state']==1) { $oauth->setToken($_GET['oauth_token'],$_SESSION['secret']); $access_token_info = $oauth->getAccessToken($acc_url); $_SESSION['state'] = 2; $_SESSION['token'] = $access_token_info['oauth_token']; $_SESSION['secret'] = $access_token_info['oauth_token_secret']; } $oauth->setToken($_SESSION['token'],$_SESSION['secret']); $oauth->fetch("$api_url/user.json"); $json = json_decode($oauth->getLastResponse()); print_r($json); } catch(OAuthException $E) { print_r($E); } } } ?>