Class not found PHP

11,919

Are you sure that this is correct way? :

require_once("Abraham/TwitterOAuth/TwitterOAuth.php");

you could try:

require_once("Abraham/autoload.php"); 
require_once("Abraham/TwitterOAuth/TwitterOAuth.php"); 
use Abraham\TwitterOAuth\TwitterOAuth;
Share:
11,919
Slim Shady
Author by

Slim Shady

I'm Slim Shady, yes I'm the real Shady All you other Slim Shadys are just imitating

Updated on June 04, 2022

Comments

  • Slim Shady
    Slim Shady almost 2 years

    I used THIS twitter librabry and getting this error. Can anyone tell where i am going wrong ?

    ERROR

    Fatal error: Class 'Abraham\TwitterOAuth\Config' not found in D:\wamp\www\Abraham\TwitterOAuth\TwitterOAuth.php on line 17
    

    PHP

    <?php
    
    require_once("Abraham/TwitterOAuth/TwitterOAuth.php"); //Path to twitteroauth library you downloaded in step 3
    
    //keys and tokens initialised
    
    
    function getConnectionWithAccessToken($cons_key, $cons_secret, $oauth_token, $oauth_token_secret) {
      $connection = new TwitterOAuth($cons_key, $cons_secret, $oauth_token, $oauth_token_secret);
      return $connection;
    }
    
    $connection = getConnectionWithAccessToken($consumerkey, $consumersecret, $accesstoken, $accesstokensecret);
    
    $tweets = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$twitteruser."&count=".$notweets);
    
    echo json_encode($tweets);
    echo $tweets; //testing remove for production   
    ?>
    
  • Slim Shady
    Slim Shady about 9 years
    there is a composer.json file but how to use it ? @fateddy
  • Slim Shady
    Slim Shady about 9 years
    now Fatal error: Class 'TwitterOAuth' not found in D:\wamp\www\test.php on line 36