Php Twitter Tamagotchi And Roflcon

Hot off the heels of ROFLcon in NYC the crew kicks some in studio technolust. Darren shares with you his custom Twitter tamagotchi bot written in PHP with some sweet RSS parsing, VLC controlling, curl loving nested goodness. Plus guest Jim Louderback, gadget lover and Revision3 stage hand, joins us to talk about all things new media.

When we were first approached to attend ROFLthing in NYC we were asked if we could put together some sort of interactive media installation for the after party. My first thought was a web controlled paintball gun similar to the USB Missile launcher but, well, the lawyers didn't think it was a good idea.

So I started thinking about the whole ROFLthing concept, it's a congregation of Internet celebrities and web 2.0 kids. And what better way to showcase the usefulness of a service like twitter with the uselessness of that clever little electronic pet the tamagotchi.

The project is split up into three parts. First a directory full of videos that weíll control from the web using VLC, PHP and Curl. I made my tamagotchi videos using Photoshop and Vegas.

Second we need to be able to control VLC from the command line so fire up VLC and point it at your directory of videos with the --intf=http, --fullscreen and ñrepeat parameters. Now we can browse to http://127.0.0.1:8080 to hit the local http interface. Check out the /old/ directory to get the old interface. Here we find the parameters to post to the http server using curl. Try changing the item number from the command line with curl 127.0.0.1:8080/old/ -d control=play -d item=5 ñG. Adjust accordingly.

Now that weíve got VLC playing a directory of videos fullscreen and we can control it from the command line its time to duct tape together some PHP. In order to easily query Twitter for input Iím using the MagpieRSS class to parse the feed of a search query from search.twitter.com. A case and switch statement within a while loop does all of the magic, checking the input and making a system call to curl.

It may not be beautiful code but it works and for a few hours of hacking Iím somewhat proud of it. Especially considering how rusty my code is. Now Iím sure it could be replaced with 8 lines of perl so I welcome your constructive criticism on the forums where youíll find the full source code.

Iím sure now that youíre loaded with these techniques you can find all sorts of uses for parts of this project.

Thanks for downloading. Remember you can find subscription links and our new iTunes HD feed at hak5.org.

Keep the constructive feedbacks coming, we've seen a lot of great stuff lately on the forums so thanks for that.

Don't forget we've got brand new sticker packs as thanks for your donations at www.hak5.org/stickers. We really appreciate your support!

February 6-8 we'll be in DC for Shmoocon

If you're in the area we'll be attending the anual podcasters meetup come out meet the crew and lots of other great podcasters from PaulDotCom, Securabit, Sploitcast, Cyber Speak, Security Justice and more.

Get all the details at podcastersmeetup.com

Special shout out to the hacker hound from Hoboken, Brandi, and her pet Jon for all the generosity in NYC this weekend.