Skip to content

Instantly share code, notes, and snippets.

@0xnbk
Forked from abraham/twitter.php
Created November 5, 2010 10:57
Show Gist options
  • Save 0xnbk/663973 to your computer and use it in GitHub Desktop.
Save 0xnbk/663973 to your computer and use it in GitHub Desktop.
How to tweet with OAuth in three lines
<?php
// Download the latest version of TwitterOAuth from http://github.com/abraham/twitteroauth/downloads
// Unpack the download and place the twitteroauth.php and OAuth.php files in the same directory as this file.
// Register an application at http://dev.twitter.com/apps and from your new apps page get "my access token".
require_once('twitteroauth.php');
$connection = new TwitterOAuth('app consumer key', 'app consumer secret', 'my access token', 'my access token secret');
$connection->post('statuses/update', array('status' => 'text to be tweeted'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment