Showing your last “twit” using php

While editing my blog theme, I decided to add my last thoughts in twitter to the website. Came with a very simple php code that will get the information from the last twitter post and show it as a text line, so you can add in anywhere you want.

This is the code:

< ?php
preg_match('#(.*)#',file_get_contents(''), $matches);
echo $matches[0]

Of course, remember to change username for your own.

2 comments on “Showing your last “twit” using php

  1. titanium_geek June 5, 2007 5:11 am

    Hi Daniel- found you through Paul Stamatiou’s site, and since I don’t use wordpress (and thus no wordpress plugin goodness), I’m attempting your twitter method, as it appears to be platform independent. However, I put it in a php file on my site, and it just prints out the php file, not the tweet.

    php works fine on the site, though.

    the link is

  2. titanium_geek June 5, 2007 5:22 am

    yes I’m dumb… I removed the space between < and ? at the php, and now it doesn’t just print the contents of the php file. It doesn’t show the twitter info either though.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.