require_once 'twitteroauth.php';
define("CONSUMER_KEY", "XXXXXXXXXXXXXXXXXXXXXXXXXX");
define("CONSUMER_SECRET", "XXXXXXXXXXXXXXXXXXXXXXXXXX");
define("OAUTH_TOKEN", "XXXXXXXXXXXXXXXXXXXXXXXXXX");
define("OAUTH_SECRET", "XXXXXXXXXXXXXXXXXXXXXXXXXX");
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_SECRET);
$content = $connection->get('account/verify_credentials');
$image = 'URL_OF_IMAGE';
$status_message = 'Hello This is Posting from API to twitter.';
$status = $connection->upload('statuses/update_with_media', array('status' => $status_message, 'media[]' => file_get_contents($image)));
echo json_encode($status);
No comments :
Post a Comment