On 8/11/10 7:21 PM, Skygazer wrote:
> Using Abraham Williams twitteroauth library I used this base code to
> post Twitter. Is it that simple?
> 
> Of course my app code is actually longer. I'm writing an app that
> takes new news stories posted to our web site and automatically tweets
> them.
> 
> A question though: What's the best way to handle $access_key which is
> the oauth_token and $access_secret which is the oauth_token_secret?
> I've read they should not be readable in your php code.
> 
> <?php
> $consumer_key = "12345";
> $consumer_secret = "6789";
> $access_key = "12345";
> $access_secret = "6789";
> 
> require_once('twitteroauth/twitteroauth.php');
> 
> $connection = new TwitterOAuth ($consumer_key ,$consumer_secret ,
> $access_key , $access_secret );
> $connection->post('statuses/update', array('status' => "my tweet"));
> ?>

Yes, OAuth is really that easy ;-)

If they aren't readable in your PHP code, then you can't use them, and
that wouldn't be very useful, would it?

Just don't give the keys to your users, and you'll be fine. When you
release the script to other websites you may want to consider using
other keys, but I don't think that that applies to you.

Tom

Reply via email to