Skip to content

Instantly share code, notes, and snippets.

@naeluh
Created December 9, 2014 22:24
Show Gist options
  • Save naeluh/e77b9d18697ecd036988 to your computer and use it in GitHub Desktop.
Save naeluh/e77b9d18697ecd036988 to your computer and use it in GitHub Desktop.
require 'vendor/TwitterAPIExchange.php';
$settings = array(
'oauth_access_token' => "",
'oauth_access_token_secret' => "",
'consumer_key' => "",
'consumer_secret' => ""
);
$url = "https://api.twitter.com/1.1/statuses/update.json";
$postfields = array('status' => 'test');
$requestMethod = 'POST';
$twitter = new TwitterAPIExchange($settings);
$response = $twitter->buildOauth($url, $requestMethod)
->setPostfields($postfields)
->performRequest();
echo '<pre style="color:black;">';
var_dump(json_decode($response));
echo '</pre>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment