Automatic status update Using Twitter OAuth


#1

I am using below code for auto post on twitter :
include “include/twitteroauth/twitteroauth.php”;

// You need to use the actual values from Twitter
$connection = new TwitterOAuth(array(
‘consumer_key’ => ‘XXXX’,
‘consumer_secret’ => ‘XXXX’,
‘user_token’ => ‘122473651-XXXXX’,
‘user_secret’ => ‘XXXX’,
));

// Make the API call
$connection->post(‘statuses/update’, array(‘status’ => ‘HelloWorld’));

But getting error:
stdClass Object ( [request] => /1/statuses/update.json [error] => Could not authenticate you. )


#2

You should be using the following keys:

$connection = new TwitterOAuth(array( 'consumer_key' => '...', 'consumer_secret' => '...', 'access_token' => '...', 'access_token_secret' => '...', ));

If those are you actual tokens you should reset the consumer key on https://dev.twitter.com/apps right now.


#3

Hi,
i have an example for send tweet without autenticate, this work fine, but when i put this in other project, i have an error.

i have this…

for($i=0; $i<count($xml->entry); $i++)
{
$crtEntry = $xml->entry[$i];
$account = $crtEntry->author->uri;
$image = $crtEntry->link[1]->attributes()->href;
$tweet = str_replace(’<a href=’, ‘<a target="_blank" href=’, $crtEntry->content);
$id = $crtEntry->id;

	$sql=mysql_query("select code from codes where state=0 order by rand()");

$showfetch=mysql_fetch_array($sql);
$cod = $showfetch[‘code’];

if(mysql_query(“INSERT INTO tweets (user, tweet, date, tui) VALUES (’”.$account."’, ‘".$tweet."’,now(),’".$id."’)"))
{
$tweety->post(‘statuses/update’, array(‘status’ => ‘Congrats ‘.$account.’ you code is: ‘.$cod.’ http://www.webpage.com/’));
mysql_query(“UPDATE codes SET state=‘1’ WHERE code like ‘$cod’”);}

But when i Insert en my table and post in twitter, this is crash. my web page is blank.

How i can post in twitter from the webpage, without exit from the page ?

Sorry 4 my english.

Grettings from Chile


#4

for($i=0; $i<count($xml->entry); $i++)


#5

Gmn cara auto nya bousss. ???


#6

Says suspended account and cannot e-mail to my address. Dont know if getting m
y messages on mytwitter account. Read procedures and rules. Didn’t think I was doing to much that was wrong. Will not go back and forth from now on just make general statements. To many get upset.


#7

E-mail sent that account is opened.Not able to login.Says suspended but could be error.Read rules , apologized and cant do or remove tweets from account when suspended? Dont know what to do.