· 6 years ago · Feb 28, 2019, 01:08 AM
1$connection->request('POST',
2$connection->url('1/statuses/update'),
3array('status' => $tweet_text));
4
5$connection->post('1/direct_messages/new', array('text' => 'dm text here', 'FROM_TWITTER_NAME' => 'TO_TWITTER_NAME'));
6
7$method = 'direct_messages/new';
8$receiverScrName = "SCREEN_NAME";
9$parameters = array('screen_name' => $receiverScrName, 'text' => 'how are you');
10$connection->post($method, $parameters);
11
12$tweet = "This is my tweet";
13
14$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $oauth_token, $oauth_token_secret);
15$connection->post('statuses/update', array('status' => $tweet));
16
17$msg = "This is my direct message";
18
19$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $oauth_token, $oauth_token_secret);
20$connection->post('direct_messages/new', array('user_id' => $user->id, 'text' => $msg));