Step 8Twitter Setup
Twurl is almost like curl but for Twitter. I did some ugly parsing of the twitter RSS feed to retrieve the tweet sender, but it works!
Here is my bash script
#!/bin/bash
mycode=`curl --silent http:/my.apexserver.com/pls/apex/getcode`
twitter=`twurl /1/statuses/mentions.rss | grep "@tweetfortreat $mycode" | cut -d ':' -f1 | tail -n 1 | cut -d '>' -f2`
echo $mycode $twitter
if [ -n "$twitter" ]; then
iobridge=`curl --silent http://www.iobridge.com/widgets/static/id=[widgetID]`
newkey=`curl --silent -d "code=$mycode" http:/my.apexserver.com/pls/apex/updatecode`
update=`twurl -d "status=@$twitter The code $mycode is correct. Happy Halloween!" /1/statuses/update.xml`
echo $newkey $iobridge
fi
Crontab will only allow you to execute a script every minute and I think is fine for now. Alternatively a while loop could be used instead.
Here is my crontab entry
*/1 * * * * /script_location/HalloweenCandy.sh > /dev/null 2>&1
| « Previous Step | Download PDFView All Steps | Next Step » |
![]() |
Add Comment
|

















































