tags:

views:

73

answers:

3

I want to add an additional functionality to a CMS I am making that will allow users to add content to a site via text message. The user should be able to upload an image and add text and send the message to a number which when received will update the database accordingly.

Can this be done, and can it be done via PHP because that's the only language I know? Also what would be the general outline to achieve such a thing?

+2  A: 

You have to find a SMS gateway that supports "incoming" of SMS. Click-a-tell is generally the one people choose because of their API and documentation, they aren't free though. If you do a quick Google search for "SMS Gateway" you'll find plenty of other solutions.

Once you choose the gateway you want to go with, the rest of the process is easy. You would just handle the SMS as a regular request into your application.

Hope that helps you get started!

Raphael Caixeta
Click-a-tell is popular, no doubt. But I wouldn't characterize it as "generally the one people choose". Thousands of Twilio developers would see it differently ;) (Yes, I work at Twilio so you may discard my opinion as you see fit. BUT, before I worked there, I was a very satisfied customer and found it much easier to work with than other gateways).
John Sheehan
I never heard of Twilio prior to this comment, looks nifty though, thanks.
Raphael Caixeta
A: 

Completing the answer by Raphael Caixeta, I recommend that you use the standalone PHP binary to run a pre-determined script, which parameters you'll get from the SMS/MMS. This way you can separate the two process:

1) Make a script and test it by running it through the command line. 2) Implement the SMS/MMS receiver software so that it parses the messages and runs the first script with custom parameters.

Spidey
Why use the standalone binary? He seems to be developing a web-based CMS, so I think it would be more natural to use one of the SMS->HTTP gateways. Then, he can receive messages using his existing PHP setup (e.g. mod_php).
Matthew Flaschen
No special reason. I just thought of the SMS receiver software as a daemon that would run commands, not as a http requester. Just plain old ignorance.
Spidey
A: 

Use one of the many SMS gateways out there like Twilio (whom I work for, but loved before I was an employee) which has a really simple API and great documentation. There are tons of PHP examples. When you receive a message, a simple POST request is made to a URL you specify with parameters for To, From and Body. Also if you return text from the URLs you use to receive messages you can respond back to them. You can also initiate outbound SMS from the same number using the REST API.

Twilio does not currently support MMS (needed for your image uploading requirement) and is not free, but you only pay for what you use at $.03/message.

John Sheehan