Hi Paul, > 1. Do I need to upgrade to OAuth?
Twitter are killing off basic authentication on 16th August, so you'll need to upgrade. > 2. If I need to upgrade to OAuth, can it be done in such a way as to > work without browser login and redirect requirements? (as per example) The Twitter OAuth tokens don't currently expire so you could do the auth once then store the tokens for later non-interactive use. > 3. If 2 is true, any tutorials that match that situation you can point > me to? Don't know if you're tied to a current library but http://github.com/jmathai/twitter-async does a good job of OAuth. Rough process: One off: 1) Login to your company Twitter account. 2) Settings -> Connections -> Click the link under Developers at bottom right. Takes you to: http://twitter.com/apps 3) Register your app. You can get away with 127.0.0.1 as the callback URL if you're running a local webserver, but it's not so important if you're just doing this as a one off as you can specify callback URL at request time. You'll probably want: Type: Browser Access Type: Read & Write Use Twitter for login: No This will get you your consumer key & secret. 4) Assuming use of twitter-async, here's some scrappy code that'll get you your tokens: <?php require_once "twitter-async/EpiCurl.php"; require_once "twitter-async/EpiOAuth.php"; require_once "twitter-async/EpiTwitter.php"; define( "CONSUMER_KEY", "XXXXX" ); define( "CONSUMER_SECRET", "XXXXX" ); $twitter = new EpiTwitter( CONSUMER_KEY, CONSUMER_SECRET ); if( isset( $_GET["oauth_token"] ) ) { try { $twitter->setToken( $_GET["oauth_token"] ); $token = $twitter- >getAccessToken( array( "oauth_verifier" => $_GET["oauth_verifier"] ) ); var_dump( $token->oauth_token, $token- >oauth_token_secret ); } catch( Exception $e ) { var_dump( get_class( $e ) ); } } else header( "Location: " . $twitter->getAuthorizeUrl( null, array( "oauth_callback" => "http://127.0.0.1/ path_to_this_script.php" ) ) ); ?> Obviously change the callback URL to point to wherever you host this script, and fill in your consumer key/secret. After you've authed the account, twitter will bring you back and the script will spit out your oauth_token and oauth_secret. So from now on if you want to tweet, you simply: $twitter = new EpiTwitter( CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET ); $twitter->post_statusesUpdate( array( "status" => "Something exciting happened!" ) ); There's probably an easier way to get the tokens, but this worked well for me. Hope this helps, - Paul
