index.php and I want to include
class.twitter.php inside it, how do I do this?
Hopefully then when I put the below code in index.php it will work.
$t = new twitter(); $t->username = 'user'; $t->password = 'password'; $data = $t->publicTimeline();
Your code should be something like
require_once('class.twitter.php'); $t = new twitter; $t->username = 'user'; $t->password = 'password'; $data = $t->publicTimeline();
You can use either of the following:
require_once if you want to ensure the class is only loaded once during execution) will cause a fatal error to be raised if the file doesn't exist, whereas
include will only raise a warning. See http://php.net/require and http://php.net/include for more details