Reputation: 953
I am implementing SMS paying sistem. User sends message with some code and buys some features on my site.
But to do that I need to handle 2 HTTP/S GET requests and get information from them.
First request is like this :
http://www.yourpage.com/sms/receive.php?sms-id=%sms-id%&operator-id=%operator-id%&from=%from%&to=%to%&text=%text%
How would be easiest way to handle theese requests and based on them make changes in my database ?
SO far I googled "HOW to handle HTTP/S requests in my Rails app" I got zero usefull sources. I got only sources that explains how to make HTTP/S requests but not how to handle them and use.
Is there any suggestion to this problem ?
Thanks in advance!
Upvotes: 0
Views: 335
Reputation: 7997
A Rails controller handles incoming HTTP requests. To generate one, run the following from the command line:
rails generate controller sms receive
This will create an SmsController.rb
file with a function named receive
.
In that function, do something like this:
def receive
sms_id=params[:sms_id]
... do something ...
end
and I'd recommend learning Rails basics :)
Upvotes: 2