Welcome to WebmasterWorld Guest from 54.163.52.98

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

using php to post to twitter

using php to post to twitter

     

drooh

11:36 pm on Jun 27, 2011 (gmt 0)

5+ Year Member



Ive tried several examples and each time I go to my script it asks me to login with twitter. Is there a way to authorize once and then not have to do it or log in each time?

Im using
[github.com...]

But its just a bit over my head. Anyone know of an easy way to use php to post to twitter?

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

/* If access tokens are not available redirect to connect page. */
if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) {
header('Location: ./clearsessions.php');
}
/* Get user access tokens out of the session. */
$access_token = $_SESSION['access_token'];

/* Create a TwitterOauth object with consumer/user tokens. */
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);

/* If method is set change API call made. Test is called by default. */
$content = $connection->get('account/verify_credentials');

/* Some example calls */
$connection->post('statuses/update', array('status' => 'test again'));

frankb3

11:53 pm on Jun 27, 2011 (gmt 0)



I'd be interested too. I'm trying to Tweet with mySQL through TwitterFeed without much success.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month