· 7 years ago · Aug 22, 2018, 01:04 AM
1// OAuth To Twitter
2require_once 'files-notifiche-twitter/twitteroauth.php';
3
4// Do NOT Share (sono i token)
5define("CONSUMER_KEY", "xxx");
6define("CONSUMER_SECRET", "xxx");
7define("OAUTH_TOKEN", "xxx");
8define("OAUTH_SECRET", "xxx");
9
10// Post To Twitter
11$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_SECRET);
12$content = $connection->get('account/verify_credentials');
13$connection->post('statuses/update', array('status' => 'tweet'));
14
15
16if ($connection->getLastHttpCode() != 200) { //se non è riuscito a scrivere il tweet riprova
17 print_r('<br>Error try again<br>');
18}
19else{
20 print_r('<br>Notifica twitter funziona<br>');
21}
22
23print_r('OK');