Tweetledee

A PHP library that provides an incredibly easy way to access Twitter data formatted as JSON or a RSS feed

View project onGitHub

Tweetledee Usage

How to Use the Tweetledee Files on Your Server

The following examples demonstrate how to use Tweetledee on your web server. They assume that you uploaded the Tweetledee files as shown in the install guide. If you are having problems with Tweetledee, you can find more information about how to get help and report bugs here.

The following file types come in two flavors, a non-cached version (i.e. the original versions of the files through release v0.3.6) and a cached version (included since release v0.4.0).

To implement the caching yourself, append the suffix _nocacheto the filenames below. For instance, the non-cached version of userrss.phpis userrss_nocache.phpand the non-cached version of userjson_pp.phpis userjson_pp_nocache.php.

Contents

JSON Types

RSS Feed Types

JSON Types

Note that pretty printed JSON is obtained by adding the _ppsuffix to the base file name. For example, userjson.phpbecomes userjson_pp.phpand userjson_nocache.phpbecomes userjson_pp_nocache.php.

Standard JSON and pretty printed JSON require PHP v5.3 and above. Prior to version 0.4.1 of Tweetledee, pretty printed JSON was supported for PHP versions 5.4 and above.

Favorites JSON favoritesjson.php+ favoritesjson_pp.php

Default Favorites JSON
http://[yourdomain]/tweetledee/favoritesjson.php
Optional URL Parameters
Parameter Description Default Values
c Tweet count 25 1 - 200
cache_interval Caching interval 90 sec any (in secs)
user Twitter user you any username
Favorites JSON with 100 Tweets
http://[yourdomain]/tweetledee/favoritesjson.php?c=100
Favorites JSON with Caching Interval of 5 Minutes (300 sec)
http://[yourdomain]/tweetledee/favoritesjson.php?cache_interval=300
Favorites JSON for a Different User
http://[yourdomain]/tweetledee/favoritesjson.php?user=csimpkins
All Options
http://[yourdomain]/tweetledee/favoritesjson.php?c=100&user=csimpkins&cache_interval=300

Home Timeline JSON homejson.php+ homejson_pp.php

Default Home Timeline JSON
http://[yourdomain]/tweetledee/homejson.php
Optional URL Parameters
Parameter Description Default Values
c Tweet count 25 1 - 200
cache_interval Caching interval 90 sec any (in secs)
xrp Exclude replies 0 (=false) 1 (=true)
Home Timeline with 100 Tweets
http://[yourdomain]/tweetledee/homejson.php?c=100
Home Timeline with Caching Interval of 5 Minutes (300 sec)
http://[yourdomain]/tweetledee/homejson.php?cache_interval=300
Home Timeline, Exclude Replies
http://[yourdomain]/tweetledee/homejson.php?xrp=1
All Options
http://[yourdomain]/tweetledee/homejson.php?c=100&xrp=1&cache_interval=300

List JSON listsjson.php+ listsjson_pp.php

Default Lists JSON
http://[yourdomain]/tweetledee/listsjson.php?list=[list-slug]
Required URL Parameter
Parameter Description Default Values
list List slug name (required) any list slug
Optional URL Parameters
Parameter Description Default Values
c Tweet count 25 1 - 200
cache_interval Caching interval 90 sec any (in secs)
user Twitter user you any username
xrt Exclude retweets 0 (=false) 1 (=true)
Your list called "reading-list"
http://[yourdomain]/tweetledee/listsjson.php?list=reading-list
Your list called "reading-list" with caching interval of 5 minutes (300 sec)
http://[yourdomain]/tweetledee/listsjson.php?list=reading-list&cache_interval=300
@anotheruser's list called "reading-list"
http://[yourdomain]/tweetledee/listsjson.php?user=anotheruser&list=reading-list
100 tweets from your list called "reading-list"
http://[yourdomain]/tweetledee/listsjson.php?c=100&list=reading-list
Exclude retweets from your list called "reading-list"
http://[yourdomain]/tweetledee/listsjson.php?xrt=1&list=reading-list
All options
http://[yourdomain]/tweetledee/listsjson.php?user=anotheruser&list=reading-list&c=100&xrt=1&cache_interval=300

Tweet Search JSON searchjson.php+ searchjson_pp.php

Default Tweet Search JSON
http://[yourdomain]/tweetledee/searchjson.php?q=[search_term]
Required URL Parameter
Parameter Description Default Values
q Search query (required) any search term
Optional URL Parameters
Parameter Description Default Values
c Tweet count 25 1 - 200
cache_interval Caching interval 90 sec any (in secs)
rt Result type mixed popular | recent
Search for "test"
http://[yourdomain]/tweetledee/searchjson.php?q=test
Search for "test" with caching interval of 5 minutes (300 sec)
http://[yourdomain]/tweetledee/searchjson.php?q=test&cache_interval=300
Search for "test", Return 200 Results
http://[yourdomain]/tweetledee/searchjson.php?q=test&c=200
Search for "test", Realtime Tweet Search (i.e. recent)
http://[yourdomain]/tweetledee/searchjson.php?q=test&rt=recent
Search for "test", Popular Tweet Search (i.e. popular)
http://[yourdomain]/tweetledee/searchjson.php?q=test&rt=popular
All Options
http://[yourdomain]/tweetledee/searchjson.php?q=test&rt=recent&c=75&cache_interval=300

User Timeline JSON userjson.php+ userjson_pp.php

Default User Timeline JSON
http://[yourdomain]/tweetledee/userjson.php
Parameter Description Default Values
c Tweet count 25 1 - 200
cache_interval Caching interval 90 sec any (in secs)
user Twitter user you any username
xrp Exclude replies 0 (=false) 1 (=true)
xrt Exclude retweets 0 (=false) 1 (=true)
User Timeline with 100 Tweets
http://[yourdomain]/tweetledee/userjson.php?c=100
User Timeline with 100 Tweets and Caching Interval of 5 Minutes (300 sec)
http://[yourdomain]/tweetledee/userjson.php?c=100&cache_interval=300
User Timeline of a Different User (@csimpkins)
http://[yourdomain]/tweetledee/userjson.php?user=csimpkins
User Timeline, Excluding All Replies
http://[yourdomain]/tweetledee/userjson.php?xrp=1
User Timeline, Excluding All Retweets
http://[yourdomain]/tweetledee/userjson.php?xrt=1
All Options
http://[yourdomain]/tweetledee/userjson.php?c=100&user=csimpkins&xrp=1&xrt=1&cache_interval=300

RSS Feed Types

: RSS feeds require PHP v5.3 and above.

Favorites RSS Feed favoritesrss.php

Default Favorites RSS Feed
http://[yourdomain]/tweetledee/favoritesrss.php
Optional URL Parameters
Parameter Description Default Values
c Tweet count 25 1 - 200
cache_interval Caching interval 90 sec any (in secs)
user Twitter user you any username
recursion_limit Limit the number of "parent" tweets to load when loading a response tweet 0 Any positive integer
Favorites RSS Feed with 100 Tweets
http://[yourdomain]/tweetledee/favoritesrss.php?c=100
Favorites RSS Feed with Caching Interval of 5 Minutes (300 sec)
http://[yourdomain]/tweetledee/favoritesrss.php?cache_interval=300
Favorites RSS Feed for a Different User
http://[yourdomain]/tweetledee/favoritesrss.php?user=csimpkins
All Options
http://[yourdomain]/tweetledee/favoritesrss.php?c=100&user=csimpkins&cache_interval=300

Home Timeline RSS Feed homerss.php

Default Home Timeline URL
http://[yourdomain]/tweetledee/homerss.php
Optional URL Parameters
Parameter Description Default Values
c Tweet count 25 1 - 200
cache_interval Caching interval 90 sec any (in secs)
xrp Exclude replies 0 (=false) 1 (=true)
recursion_limit Limit the number of "parent" tweets to load when loading a response tweet 0 Any positive integer
Home Timeline with 100 Tweets
http://[yourdomain]/tweetledee/homerss.php?c=100
Home Timeline with Caching Interval of 5 Minutes (300 sec)
http://[yourdomain]/tweetledee/homerss.php?cache_interval=300
Home Timeline, Exclude Replies
http://[yourdomain]/tweetledee/homerss.php?xrp=1
All Options
http://[yourdomain]/tweetledee/homerss.php?c=100&xrp=1&cache_interval=300

List RSS Feed listsrss.php

Default Lists RSS Feed
http://[yourdomain]/tweetledee/listsrss.php?list=[list-slug]
Required URL Parameter
Parameter Description Default Values
list List slug name (required) any list slug
Optional URL Parameters
Parameter Description Default Values
c Tweet count 25 1 - 200
cache_interval Caching interval 90 sec any (in secs)
user Twitter user you any username
xrt Exclude retweets 0 (=false) 1 (=true)
recursion_limit Limit the number of "parent" tweets to load when loading a response tweet 0 Any positive integer
Your list called "reading-list"
http://[yourdomain]/tweetledee/listsrss.php?list=reading-list
Your list called "reading-list" with caching interval of 5 minutes (300 sec)
http://[yourdomain]/tweetledee/listsrss.php?list=reading-list&cache_interval=300
@anotheruser's list called "reading-list"
http://[yourdomain]/tweetledee/listsrss.php?user=anotheruser&list=reading-list
100 tweets from your list called "reading-list"
http://[yourdomain]/tweetledee/listsrss.php?c=100&list=reading-list
Exclude retweets from your list called "reading-list"
http://[yourdomain]/tweetledee/listsrss.php?xrt=1&list=reading-list
All options
http://[yourdomain]/tweetledee/listsrss.php?user=anotheruser&list=reading-list&c=100&xrt=1&cache_interval=300

Tweet Search RSS Feed searchrss.php

Default Tweet Search Feed URL
http://[yourdomain]/tweetledee/searchrss.php?q=[search_term]
Required URL Parameter
Parameter Description Default Values
q Search query (required) any search term
Optional URL Parameters
Parameter Description Default Values
c Tweet count 25 1 - 200
cache_interval Caching interval 90 sec any (in secs)
rt Result type mixed popular | recent
recursion_limit Limit the number of "parent" tweets to load when loading a response tweet 0 Any positive integer
Search for "test"
http://[yourdomain]/tweetledee/searchrss.php?q=test
Search for "test" with caching interval of 5 minutes (300 sec)
http://[yourdomain]/tweetledee/searchrss.php?q=test&cache_interval=300
Search for "test", Return 200 Results
http://[yourdomain]/tweetledee/searchrss.php?q=test&c=200
Search for "test", Realtime Tweet Search (i.e. recent)
http://[yourdomain]/tweetledee/searchrss.php?q=test&rt=recent
Search for "test", Popular Tweet Search (i.e. popular)
http://[yourdomain]/tweetledee/searchrss.php?q=test&rt=popular
All Options
http://[yourdomain]/tweetledee/searchrss.php?q=test&rt=recent&c=75&cache_interval=300

User Timeline RSS Feed userrss.php

Default User Timeline URL
http://[yourdomain]/tweetledee/userrss.php
Optional URL Parameters
Parameter Description Default Values
c Tweet count 25 1 - 200
cache_interval Caching interval 90 sec any (in secs)
user Twitter user you any username
xrp Exclude replies 0 (=false) 1 (=true)
xrt Exclude retweets 0 (=false) 1 (=true)
recursion_limit Limit the number of "parent" tweets to load when loading a response tweet 0 Any positive integer
User Timeline with 100 Tweets
http://[yourdomain]/tweetledee/userrss.php?c=100
User Timeline with 100 Tweets and Caching Interval of 5 Minutes (300 sec)
http://[yourdomain]/tweetledee/userrss.php?c=100&cache_interval=300
User Timeline of a Different User (@csimpkins)
http://[yourdomain]/tweetledee/userrss.php?user=csimpkins
User Timeline, Excluding All Replies
http://[yourdomain]/tweetledee/userrss.php?xrp=1
User Timeline, Excluding All Retweets
http://[yourdomain]/tweetledee/userrss.php?xrt=1
All Options
http://[yourdomain]/tweetledee/userrss.php?c=100&user=csimpkins&xrp=1&xrt=1&cache_interval=300