简体   繁体   English

通过SMS更改数据库(twilio?)

[英]Database change via SMS (twilio?)

So I've got a web application, let's say with 2 sub domains a.domain.com and b.domain.com 所以我有一个Web应用程序,假设有2个子域a.domain.comb.domain.com

If there is an update on " a " -they currently get an email, and have to sign in to the website and do something. 如果在更新“ ”当前-他们收到一封电子邮件,并在登录到网站,并做一些事情。 Is there a way (maybe through Twilio??) that I could do this via SMS? 有没有办法(也许是通过Twilio ??)通过短信进行此操作?

Basically: 基本上:

1 - There's a user update to " a.subdomain.com " 1-用户更新到“ a.subdomain.com

2 - The 'owner' of " a " gets an SMS asking for 'yes' or 'no' (the sms could be sent via PHP, or twilio perhaps?) 2-“ a ”的“所有者”收到一条短信,询问“是”或“否”(短信可以通过PHP或twilio发送吗?)

3 - The 'owner' replys 'yes' and This happens. 3-“所有者”回答​​“是”,并且发生This情况。 if they reply 'no', nothing happens. 如果他们回答“否”,则什么也不会发生。

this is essentially a MySQL database change, changing a pst_stt to one of three values, and pst_dte to PHP's date(Ymd) function. this本质上是MySQL数据库更改,将pst_stt更改为三个值之一,并将pst_dte为PHP的date(Ymd)函数。

I know I can send the text via SMS. 我知道我可以通过短信发送文本。

Is there a way to RECEIVE and do something if it's received? 有没有办法接收并做一些收到的事情? All without " b .domain.com" being affected? 全部都不会受到“ b .domain.com”的影响吗? something like, " a " set's their phone number to be '555-5555'. 例如,“ a ”将其电话号码设置为“ 555-5555”。 That number get's a text asking yes or no. 这个数字是一个文本,询问是或否。 They send yes -> 他们发送是->

$text = (((the reply text received)));
$sender = (((the senders phone number)));
$phone = option('phone_number', 'options-page');

if($text == 'yes' && $sender === $phone){
    /*Do the simple Database update*/
}

I don't believe there is a way to receive SMS via php... so would something like Twilio do what I need? 我不相信有一种通过php接收短信的方法...所以像Twilio这样的事情会做我需要的吗?

You can do it with SMSIfied . 您可以使用SMSIfied做到这一点 They have a PHP library on GitHub that simplifies using their REST API with PHP. 他们在GitHub上有一个PHP库 ,可简化REST API与PHP的结合使用。 They show an example on receiving a text message with PHP on the GitHub home page. 它们显示了一个在GitHub主页上使用PHP接收文本消息的示例。

Twillio makes it really easy to do this. Twillio非常容易做到这一点。 You can look at their example pages. 您可以查看他们的示例页面。 Its a pretty fantastic service. 这是一个非常棒的服务。 You can also send text messages for free to phones if you know their service provider. 如果您知道手机的服务提供商,也可以免费向手机发送短信。 You just email thenumber@provider.com. 您只需发送电子邮件至thenumber@provider.com。 Sometimes its @txt.provider.com. 有时是@ txt.provider.com。

Twilio can provide you with a telephone number to receive SMS messages. Twilio可以为您提供电话号码以接收SMS消息。

So the user would reply to the SMS which your application will then process. 因此,用户将回复您的应用程序随后将处理的SMS。

If you look at the guides on Twilio it should help you get a better idea: 如果您查看有关Twilio的指南,它应该可以帮助您更好地了解:

https://www.twilio.com/docs/howto/sms-notifications-and-alerts https://www.twilio.com/docs/howto/sms-notifications-and-alerts

https://www.twilio.com/docs/quickstart https://www.twilio.com/docs/quickstart

https://www.twilio.com/docs/quickstart/php/sms/hello-monkey https://www.twilio.com/docs/quickstart/php/sms/hello-monkey

https://www.twilio.com/sms https://www.twilio.com/sms

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM