wordpress.com recently announced a great feature: the ability to create a blog post by simply calling a phone number and leaving a message, which shows up as an audio post on your blog. judging by the enthusiastic comments from wordpress users, this is a feature many wanted – including me.
unfortunately, the “phone your blog” feature was only made available for blogs hosted on wordpress.com – not on self-hosted installations. but don’t worry, you can actually set that up yourself – with just a little tinkering (and a small investment, if you want a non-us phone number).
basically, what you do is this:
- set up an account at twilio.com (free basic account will do)
- install the wordpress plugin “postie“, to allow posting via email with attachments
- follow the tutorials at twilio.com to create a php/xml script which greats a caller and records a message
- send the recorded message by email to your blog, including the recorded soundfile as an attachment
in order to complete steps 3 and 4 you need some basic knowledge of php and xml. but it is not overly complicated – i am no professional programmer, and got it set up and working in a couple of days. step 3 is well covered by the twilio tutorials.
as for step 4, how to do it is fairly well described by Tim at texelate.co.uk. however, notice that there are some errors in the code, probably due to formatting – the ‘\r\n’ parts of the mime lines are messed up, and at least for me the quotation marks also came out wrong after copying and pasting into dreamweaver. so for copying code lines, it might be better to go to this daniweb forum thread or this codewalkers page.
notice also that you are here dealing with a file passed as a url to the php script (by twilio), so if your server does not allow you to open urls with fopen (as in my case), you have to use curl instead. the significant lines are, for me:
// prepare file attachment
$fileatttype = “audio/mpeg”;
$fileattname = “FILENAME.mp3″;
…and from there just skip the fopen part of Tim’s script, the $data variable now contains the contents of the file and can be used to enter the file into the email using:
$data = chunk_split( base64_encode( $data ) );
…as done in Tim’s script.
bonus point: twilio only provides you with a u.s. number for incoming calls. in other words, you and the users of your blog need to call a u.s. number to leave your message. for me, as i am based in norway and am inviting members of the public to post messages in my blog, this was not a satisfactory solution – i can’t expect people to be willing to make international calls just to post to my blog. the solution? i set up a norwegian phone number which automatically forwards callers to the u.s. number provided by twilio. doesn’t cost me much – around 2.50 nok per minute (0.30 euros), i think – and as i will have a limited number of messages i expect the total expense to be less than 1-2000 nok.
my working solution can be tried out at the flannør blog – however, for the moment it is in norwegian only… feel free to ask any questions in the comments though, and i will be happy to answer as best i can (again, i am no pro in this so cut me some slack if i can’t answer).
[...] This post was mentioned on Twitter by Anders S. Løvlie, Anders S. Løvlie. Anders S. Løvlie said: New blog post: how to phone your blog on a self-hosted wordpress installation. http://wp.me/pOXhm-3u [...]
that is some crazy stuff man, why do people want to phone their blog ?
I mean I get the fact that it’s an interesting CS project, but why ?
In my case: to create a simple way for people to post audio recordings of their own texts. But that has to do with the specific requirements of the textopia project, which is about people sharing audio recordings of literary texts with each other, so they can go through the city and listen to texts which talk about the places they walk by. (More info: folk.uio.no/anderssl and textopia.org.) As for other people’s motivation in more traditional blog use, follow the link in the introduction to see the reactions from wordpress users.
I don’t have time to sit and type sometimes ! Also, it is cool to blog from live events.
Another excellent innovation to posting blogs.
I haven’t tried this one yet but I can’t wait to give this a try.
Thanks for sharing this.
very informative and good efforts