Post to Twitter with PHP

Asked

Viewed 184 times

1

I made this code to publish the news of my site directly on my Twitter, but it is not working and I can not identify the error, since it does not return anything. It does not work and not from the error, just nothing happens. I looked in several places, but I could not find a solution.

$resultado = 'Publicar no Twitter';

require_once 'twitteroauth.php';

define("CONSUMER_KEY","XXXXXXXXXXXXXXXXXXXXXXXXXX");
define("CONSUMER_SECRET","XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
define("OAUTH_TOKEN","XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
define("OAUTH_SECRET","XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");

$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_SECRET);
$content = $connection->get('account/verify_credentials');
$connection->post('statuses/update', array('status' => $resultado));
  • See if it gives any warning or error in Google Chrome’s Inspect Element.

  • The code is working perfectly, the problem was in a select that was on top. I did not think it was the query in the database, because it did not return error, but I already tidied up and now it is all right.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.