Setting Types of Return Data

With php-twitter, it is undeniable that our preference is for JSON data. This library assumes you have PHP 5.2, as it includes the json_decode() function. However, if you don’t have the JSON library enabled for some reason, php-twitter can use XML, RSS or Atom formats (when available). Please refer to the Twitter REST API docs to determine which format can be used for what data.

If you decide to use a different format, this is how you would do it:

1
2
3
4
5
$t = new twitter;
$t->username = 'user';
$t->password = 'password';

$t->type = 'xml';