Reputation: 2705
I was looking at the Twitter API but I could not manage how can I automatically post to my twitter.
I want to visit a page on my website, which then posts the timestamp on my Twitter for example.
This code worked once, but after that, no more tweets are generated:
<?php
$consumerKey = 'myKey';
$consumerSecret = 'myConsumerKey';
$oAuthToken = 'theToken';
$oAuthSecret = 'theSecret';
require_once('twitteroauth.php');
// create a new instance
$tweet = new TwitterOAuth($consumerKey, $consumerSecret, $oAuthToken, $oAuthSecret);
//send a tweet
$tweet->post('statuses/update', array('status' => 'My awesome timestamp msg'));
?>
Is there any reason that it worked once?
Upvotes: 1
Views: 1191
Reputation: 371
The new Twitter api, makes this somewhat easy. Twitter provides a page of Twitter buttons specifically designed to place on your webpage.
Upvotes: 0
Reputation: 180014
If you're attempting to post the same message again, Twitter detects when your tweet is identical to the previous one and rejects it.
Upvotes: 2