I've been pushing stuff from our website to our company twitter account automatically. Like some news updates, updates to some sections of our site, etc ... It's all been happening automatically using the Zend Framekwork Twitter service, or other very simple php code that uses a username/password hardcoded.
Now, Twitter killed the old fashion authentication. Which is the right thing开发者_如何学运维 to do when offering twitter integration to customers (which use OAuth for user-centric stuff), but for internal stuff, isn't that overkill?
Is there an easy way to update my code to make it work again? Can I somehow hard code an oauth authentication key of some sort so that I don't have to create a whole login process with database storage for a single-user application?
If you already have your system set up to use oAuth, then yes you could just hard code your key and secret key into the system, but otherwise you will have to update to handle oAuth authentication.
Here is a great tutorial to get you in the right direction: http://blog.astrumfutura.com/archives/411-Writing-A-Simple-Twitter-Client-Using-the-PHP-Zend-Frameworks-OAuth-Library-Zend_Oauth.html
Edit:
To Clarify, there is no reason you can't set things up so you connect via oAuth and then just doing this:
$consumer_key = 'xxxxxxxxxxxxxxx';
$consumer_key_secret = 'xxxxxxxxxxxxxxx';
$access_token = 'xxxxxxxxx';
$access_token_secret = 'xxxxxxxx';
$auth = $this->twitter->oauth($consumer_key, $consumer_key_secret, $access_token, $access_token_secret);
You could Update your Zend Framework Version.
In Version 1.10.8 of the Framework is an major update for Twitter oAuth included, to make in work again.
Zend Framework 1.10.8 Release
Rob Allen wrote recently on his blog about Twitter and OAuth (and made a simple application also!): http://akrabat.com/zend-framework/tweetgt-an-example-of-zend_service_twitter-via-oath/
Shameless plug - I did a simple blog article on using Oauth with Zend_Service_Twitter. Like another poster said you should double check your ZF version first though.
Here is a recent article on this issue: http://www.webmonkey.com/2010/10/connect-to-twitter-without-oauth/
精彩评论