You can also authenticate by OAuth function instead of Basic Auth.
The OAuth function requires the environment below;
First of all, you should register your client to Twitter.
Access then click “Register a new application”.
You can choose “Application Type” as you wish. If you want to use “tuitter4oauth.php” which is included in Tuitter as appendix, you should choose “Browser”.
After you save the client, you can get your “Consumer key” and “Consumer secret”.
Then you can get your access key and secret.
We describe the way of using tuitter4oauth.php here.
Copy tuitter4oauth.php from Tuitter directory to anywhere you can access by browser. Open the file by editor then put your consumer key and secret onto the first 2 rows.
$conskey = 'YOUR_CONSUMER_KEY';
$conssec = 'YOUR_CONSUMER_SECRET';
After saving, access the page by your browser. Make sure you’ve logged in Twitter by your bot account.
You can see the confirmation page to connect your client. Click “Accept”.
Now, you can get your access key and access secret.
Finally you can create the instance of TuitterOAuth.
$tuitter = new TuitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_KEY, ACCESS_SECRET);
The instance works completely same as Tuitter object.