Foolish Coder
Foolish Coder

Reputation: 405

Fatal error: Class 'Abraham\TwitterOAuth\TwitterOAuth' not found in.. in the sub folder

I am trying to tweet posts to my twitter account. Therefore I am trying famous https://github.com/abraham/twitteroauth script.

My folder structure is:

www.mysite.com/twitterbot/
|-- twitteroauth (folder) 
|   |-- Util (folder)
|   |   `-- JsonDecoder.php
|   |-- autoload.php
|   |-- Config.php
|   |-- Consumer.php
|   |-- HmacSha1.php
|   |-- Request.php
|   |-- Response.php
|   |-- SignatureMethod.php
|   |-- Token.php
|   |-- TwitterOAuth.php
|   |-- TwitterOAuthException.php
|   `-- Util.php
`-- index.php

And my index.php

    <?php

        require "twitteroauth/autoload.php";
        use Abraham\TwitterOAuth\TwitterOAuth;
        $consumerKey = "myconsumerkey"; // Consumer Key
        $consumerSecret = "mycinsumersecret"; // Consumer Secret
        $accessToken = "myaccesstoken"; // Access Token
        $accessTokenSecret = "my access token secret"; // Access Token Secret
        $connection = new TwitterOAuth($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret);
        $statues = $connection->post("statuses/update", array("status" => "I'm posting a tweet!"));

?>

When I visit to www.mysite.com/twitterbot/ is says **Fatal error**: Class 'Abraham\TwitterOAuth\TwitterOAuth' not found in mysitecom/twitterbot/index.php on line 8

8th line is $statues = $connection->post("statuses/update", array("status" => "I'm posting a tweet!"));

What I am doing wrong? how can I fix this?

Upvotes: 0

Views: 1812

Answers (1)

Kyle Domingo
Kyle Domingo

Reputation: 531

So your folder structure should really not change from the original like so (disregard the duplicate mysitecom folder)

enter image description here

Upvotes: 2

Related Questions