How to update a mysql database via SMS text messag

2019-05-24 13:23发布

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?

标签: php mysql sms
4条回答
狗以群分
2楼-- · 2019-05-24 13:47

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 $.01 per message.

查看更多
ゆ 、 Hurt°
3楼-- · 2019-05-24 13:47

You can use a GSM/3G modem (or dongle) to receive SMS messages. And this sms software can read those messages from the modem in real time and put them automatically in your database.

查看更多
beautiful°
4楼-- · 2019-05-24 13:51

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.

查看更多
We Are One
5楼-- · 2019-05-24 14:03

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!

查看更多
登录 后发表回答