Update: There were several serious shortcomings in the code below that have been resolved (Twitter #failwhale, control characters in Tweets, greedy regex).
I’ve been working on a backend for a website and needed a way to show the latest Twitter update. There is plenty of code floating around that does this, but I couldn’t find anything simple that preserved formatting, like hyperlinks to @replies, e-mail addresses, URLs, etc. Anything that did was either very bulky (lots of source files) or required a Twitter API key…so I wrote my own, self-contained in a single function call.
| Read more »
Posted in: Technology | Tags: api, php, regex, tweet, twitter