How it works

$username is a PHP variable that contains the account name. For example: scriptol for the account of this site.

You can access the xxxx.json file through HTTP with a function of the Snoopy library or equivalent. This file contains a table holding various information for each tweet. Its general structure is as follows

Entry [0] is the first tweet. There are so many entries that tweet. It contains several arrays or strings.
[text] is the index of the text of a tweet.
[user] [followers_count] contains the number of followers.

The script can afford to see the whole data. To do this, you must uncomment the line:

// print_r( $twitter);

and look at the source code of the page for a better formatting with indentation.

The script and its usage

It retrieves the table on the Twitter site and loops through the tweets.

To avoid spamming Twitter, we do one query per hour, and the tweets are saved in a file. There is also a limit of 150 requests per hour from Twitter.

To use the script:

Assign the name of the account to $username.

Assign the number of tweets to display to $maxtweets.

Place the script in an HTML page.

Upload it or store it in the www directory of Wamp.

and the rest is automatic ... Verify that your hosting is configured for PHP 5 or more.

In the case of online use, the message "Rate limit exceeded. Customers may not make more than 150 requests per hour" can occur when too many requests from the same IP have done, and that can easily happens with a shared hosting (see Rate Limiting).

The archive contains the library snoopy.php and tweets.php a demonstration HTML page that works online or locally.