Adding a tweet to your homepage without using the twitter API !?


Here is a little bit of php code to use if you just want to get it done without all of the hoop jumping that twitter now requires you to do. Note: it’s not 100% bulletproof …. but then again neither is the API, it seems.

$tweetdata = file_get_contents("", null, null, 0,40000);

preg_match('/tweet-text\">.* $tweet = explode(">", $result1[0]);
print "




It works by downloading the first 40,000 characters from the twitter URL that you specify, and grabbing only the first tweet that it finds. This is not a very efficient way to do things, and the twitter API is a much better option if you are worried about speed. It also will fail as soon as the pattern that we search for changes in their page source. However I have supplied it here as I think some people will appreciate the technique, and you might adapt it for other purposes.

Wordpress Template Developed by Matthew Aldous