I am trying to tweet posts to my twitter account. I am download the required library files from https://github.com/abraham/twitteroauth
I am geting the error
Fatal error: Uncaught Error: Class 'Abraham\TwitterOAuth\TwitterOAuth' not found in D:\xamp\htdocs\Shasta_Tools\trunk\CEP\Twitter\SampleCode\connect\index.php:12 Stack trace: #0 {main} thrown in D:\xamp\htdocs\Shasta_Tools\trunk\CEP\Twitter\SampleCode\connect\index.php on line 12
Folder structure:
Sample Code:
<?php
require "twitteroauth/autoload.php";
use Abraham\TwitterOAuth\TwitterOAuth;
// Set keys
$consumerKey = 'MyConsumerKey';
$consumerSecret = 'MyConsumerSecret';
$accessToken = 'MyAccessToken';
$accessTokenSecret = 'MyAccessTokenSecret';
// Create object
$connection = new TwitterOAuth($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret);
// Post Update
$content = $connection->post('statuses/update', array('status' => 'Test Tweet'));
?>
I already refered Fatal error: Class 'Abraham\TwitterOAuth\TwitterOAuth' not found in.. in the sub folder
How to resolve this issue.
Please advise!
Please do composer require abraham/twitteroauth
. This will solve your issue.