· 7 years ago · Aug 22, 2018, 12:10 PM
1require "files-notifiche-twitter/twitteroauth/autoload.php";
2use AbrahamTwitterOAuthTwitterOAuth;
3
4
5// Do NOT Share (sono i token)
6define("CONSUMER_KEY", "xxx");
7define("CONSUMER_SECRET", "xxx");
8define("OAUTH_TOKEN", "xxx");
9define("OAUTH_SECRET", "xxx");
10
11// Post To Twitter
12$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_SECRET);
13$content = $connection->get('account/verify_credentials');
14$connection->post('statuses/update', array('status' => 'Test Alert');
15
16Class Tweet {
17
18 use AbrahamTwitterOAuthTwitterOAuth;
19
20 function __construct()
21 require "files-notifiche-twitter/twitteroauth/autoload.php";
22 // Do NOT Share (sono i token)
23 $CONSUMER_KEY = "xxx";
24 $CONSUMER_SECRET = "xxx";
25 $OAUTH_TOKEN = "xxx";
26 $OAUTH_SECRET = "xxx";
27
28 // Post To Twitter
29 $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_SECRET);
30 $content = $connection->get('account/verify_credentials');
31 $connection->post('statuses/update', array('status' => 'Test Alert'));
32 }
33}
34$do = new Tweet();