Yii Web Service For Sms

I want to have my yii app fetch information from an sms web hook.

The web hook pattern specification is as below:

Receiving SMS Messages

Say you set your webhook URL to //myapp/index.php?password=akabanga. If your Android phone receives the text message "Im gonna pop some tags" from "+250788123132" then TextIt will POST the following:

POST //myapp/index.php?password=akabanga

event=mo_sms&id=23554&relayer=254&relayer_phone=%2B250788111111&phone=%2B250788123123&text=Im+gonna+pop+some+tags&time=2013-01-01T05:34:34.034

I want to use yii to extract the values of parameters from the POST, Perform some check on the text message and then store to database. I assume i should use yii webservice but i dont know how to go about it. Can anyone give me clue?

How do i extract the parameters from the request??

You mean, read them from the $_POST array? Like:




echo $_POST['event']; // outputs: mo_sms



I wouldnt know if it would be available in the $_POST array. I was just given that parttern to get my values from it.

Assuming am reading it from a $_POST array, do i necessarily have to create a form to do that??

thanks

What form? A form model? You could, but it’s not a requirement.

Thanks nineinchnick, i was able to get it done by checking the values of the $_POST array elements. I had to create an action under the controller that did that.

Thanks

Hi

I have got the application working, thanks.

However when i uploaded it to the server, the $_GET and $_POST are empty when i tried to run it. On local host it behaves ok but on the server it fails to get any value from $_GET or $_POST.

What could be causing it??

…EDIT…My bad figured it out.