How to use twitteroauth(PHP) for Timeline?


#1

twitteroauth is made by @abraham http://github.com/abraham/twitteroauth

config.php

<?php
define('CONSUMER_KEY', '{HIDDEN-DATA}');
define('CONSUMER_SECRET', '{HIDDEN-DATA}');
define('OAUTH_CALLBACK', 'http://the-delta.net/twitteroauth/callback.php');
?>

index.php

<?php
session_start();

require_once('twitteroauth/twitteroauth.php');
require_once('config.php');

if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) {
    header('Location: ./clearsessions.php');
}
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
?>
<!DOCTYPE html>
<html>
  <head>
    <title>The-Delta twitter client</title>
    <meta charset="utf-8"/>
    <style>
      * {
        margin: 0px;
        padding: 0px;
        font-size: 14px;
        font-family:Arial,Helvetica,sans-serif;
      }
      h1 {font-size:220%;}
      h2 {font-size:200%;}
      h3 {font-size:180%;}
      h4 {font-size:160%;}
      h5 {font-size:140%;}
      h6 {font-size:120%;}
    </style>
  </head>
  <body>
    <?
      $screen_name = $field_twitter_url;
      print_r($connection->get('statuses/user_timeline', array('screen_name' => $screen_name)));
    ?>
  </body>
  </html>

EDIT: Ok the oauth tokens wasn’t defined my bad


#2