<?php /** * @file * User has successfully authenticated with Twitter. Access tokens saved to session and DB. */ /* Load required lib files. */ session_start(); require 'config.php'; /* If access tokens are not available redirect to connect page. */ if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) { header('Location: ./clearsessions.php'); } /* Get user access tokens out of the session. */ $access_token = $_SESSION['access_token']; /* Create a TwitterOauth object with consumer/user tokens. */ $connection = new Twitter\TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']); /* If method is set change API call made. Test is called by default. */ $content = $connection->get('account/verify_credentials'); /* Some example calls */ //$connection->get('users/show', array('screen_name' => 'abraham')); //$connection->post('statuses/update', array('status' => date(DATE_RFC822))); //$connection->post('statuses/destroy', array('id' => 5437877770)); //$connection->post('friendships/create', array('id' => 9436992)); //$connection->post('friendships/destroy', array('id' => 9436992)); /* Include HTML to display on the page */ include 'html.inc';
* @file * */ /* Load required lib files. */ session_start(); require_once 'config.php'; /* If access tokens are not available redirect to connect page. */ if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) { header('Location: ./clearsessions.php'); } /* Get user access tokens out of the session. */ $access_token = $_SESSION['access_token']; /* Create a TwitterOauth object with consumer/user tokens. */ $connection = new Twitter\TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']); /* If method is set change API call made. Test is called by default. */ $content = $connection->get('account/rate_limit_status'); echo "Current API hits remaining: {$content->remaining_hits}."; /* Get logged in user to help with tests. */ $user = $connection->get('account/verify_credentials'); $active = FALSE; if (empty($active) || empty($_GET['confirmed']) || $_GET['confirmed'] !== 'TRUE') { echo '<h1>Warning! This page will make many requests to Twitter.</h1>'; echo '<h3>Performing these test might max out your rate limit.</h3>'; echo '<h3>Statuses/DMs will be created and deleted. Accounts will be un/followed.</h3>'; echo '<h3>Profile information/design will be changed.</h3>'; echo '<h2>USE A DEV ACCOUNT!</h2>'; echo '<h4>Before use you must set $active = TRUE in test.php</h4>'; echo '<a href="./test.php?confirmed=TRUE">Continue</a> or <a href="./index.php">go back</a>.'; exit; } function twitteroauth_row($method, $response, $http_code, $parameters = '')