PDA

View Full Version : scripting twitter



kirk ammon
September 20th, 2009, 06:32 AM
I would like to set up a twitter account that can act as a connection between my computer and cell phone. (i.e. being able to run certain commands on my computer by texting the command to twitter). I have used the API before and know some of the basics, but currently I have my computer running a script every minute through cron to check twitter for messages from my phone. This is a waste of processor and is slow to respond (I have to wait up to a minute each time.) Is there a way for my computer to receive tweets in real time and only run a script after receiving a tweet?

jimi_hendrix
September 20th, 2009, 01:36 PM
You could just use a while loop and sleep at the end of it for a second...this may use more cycles, but it will be a faster response

Reiger
September 20th, 2009, 01:46 PM
You don't need twitter for that (and from a privacy p.o.v. arguably better if you didn't use a ‘publicly accessible service’ like that): somebody on these forums already wrote an utility to do that directly via SMS.

fiddler616
September 20th, 2009, 02:38 PM
Yes. Try SMSing to an email address, and you'll get an email address for your phone's SMS.

I'm actually playing around with that right now--should be done within a month (getting Wikipedia onto phone).

fiddler616
September 20th, 2009, 02:45 PM
Also:
Look into the smtp library for sending, and either pop3 or imap4 for receving.
I'd get a dedicated Gmail account for all this. And look at the Gmail help center to find out which ports to use. And don't forget to use the SSL-enabled methods, otherwise it won't work.
You can find sample code either at the bottom of the API page, or more feature-ful code by Googling around.

kirk ammon
September 20th, 2009, 08:49 PM
awesome. great ideas fellas.

fiddler616
September 20th, 2009, 11:02 PM
You would earn major geek points if you got the program running on a separate computer (do you have an old one in the basement?), and then had it SSH things to the main one. That might be a bit ambitious, though.