PHP code example of cjrasmussen / twitter-api
1. Go to this page and download the library: Download cjrasmussen/twitter-api library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cjrasmussen / twitter-api example snippets
use cjrasmussen\TwitterApi\TwitterApi;
$twitter = new TwitterApi($consumer_key, $consumer_secret);
// SEND A TWEET WITH OAUTH TOKEN/SECRET
$twitter->auth(TwitterApi::AUTH_TYPE_OAUTH, $token, $secret);
$response = $twitter->request('POST', '1.1/statuses/update.json', ['status' => 'Tweet text']);
// SEND A TWEET WITH BEARER TOKEN
$twitter->auth(TwitterApi::AUTH_TYPE_BEARER, $token);
$response = $twitter->request('POST', '1.1/statuses/update.json', ['status' => 'Tweet text']);