问题
I have this problem and are a lot of days that i'm tring to solve it.
I write a tweet using twitterOAuth
// OAuth To Twitter
require_once 'files-notifiche-twitter/twitteroauth.php';
// Do NOT Share (sono i token)
define("CONSUMER_KEY", "xxx");
define("CONSUMER_SECRET", "xxx");
define("OAUTH_TOKEN", "xxx");
define("OAUTH_SECRET", "xxx");
// Post To Twitter
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_SECRET);
$content = $connection->get('account/verify_credentials');
$connection->post('statuses/update', array('status' => 'tweet'));
if ($connection->getLastHttpCode() != 200) { //se non è riuscito a scrivere il tweet riprova
print_r('<br>Error try again<br>');
}
else{
print_r('<br>Notifica twitter funziona<br>');
}
print_r('OK');
This code works to write the tweet but then, in the last part, is how ther's an error...infact the print_r
inside if statement is didn't write.
The same for last print_r('OK')
Something break my code and i don't understand what....
Can you help me?
来源:https://stackoverflow.com/questions/51958555/write-a-tweet-using-twitteroauth-return-an-error