Sending SMS from rails

Hi,
I’m relatively new to rails so I’m sorry if this question seems
ridiculous!

I’m creating an application to send SMS messages, I got a gateway URL
like:

http://www.domain.com/sendsms/sendsms.asp?username=xxxx&password=xxxx&mno=999999&msg=xxx
&Sid=xxx&fl=0&mt=0
http://www.it2sy.com/html/sendsms/sendsms.asp?username=xxxx&password=xxxx&mno=971504858561&msg=Welcome%20to%20IT2SYtechnologies%20&Sid=IT-4U&fl=0&mt=0

I created a simple form that enables the user to enter the text of the
short
message, the sender name (or number), and the destination mobile number.
A
copy of the message should be stored in the database as the user sends
it. I
have created a Message model that has the required fields.

I have the following scaffold-generated create method that creates a
message
and stores it in the database:

****http://www.it2sy.com/html/sendsms/sendsms.asp?username=xxxx&password=xxxx&mno=971504858561&msg=Welcome%20to%20IT2SYtechnologies%20&Sid=IT-4U&fl=0&mt=0


def create
@message = Message.new(params[:message])

respond_to do |format|
  if @message.save
    flash[:notice] = 'Message was successfully created.'
    format.html { redirect_to(@message) }
    format.xml  { render :xml => @message, :status => :created,

:location => @message }
else
format.html { render :action => “new” }
format.xml { render :xml => @message.errors, :status =>
:unprocessable_entity }
end
end
end


My question is: How can I transparently touch the gateway’s URL and pass
the
required arguments to it when the user submits the form?

Your help is really appreciated.

On 2 Mar 2008, at 11:11, AN@S wrote:

the short message, the sender name (or number), and the destination
mobile number. A copy of the message should be stored in the
database as the user sends it. I have created a Message model that
has the required fields.

I have the following scaffold-generated create method that creates a
message and stores it in the database:

You need to have a look at the Net::HTTP libraries, which allows you
to make http requests of various sorts. If i were you, I’d add a send
method to the Message model which does the necessary dtugg.

Fred

Thank you Frederick, I’m looking into this library, but does it really
require using a library to send a get request?

Regards

On 02/03/2008, Frederick C. [email protected] wrote:

URL like:

  else

pass the required arguments to it when the user submits the form?


Anas Marrawi
Visit me at: www.anasonline.net

not really
if you are on linux you can send it by adding a
wget *http://www.domain.com/sendsms/sendsms.asp?username=xxxx&password=xxxx&mno=999999&msg=xxx &Sid=xxx&fl=0&mt=0http://www.it2sy.com/html/sendsms/sendsms.asp?username=xxxx&password=xxxx&mno=971504858561&msg=Welcome%20to%20IT2SYtechnologies%20&Sid=IT-4U&fl=0&mt=0
*

but this is hacky.

On 3 Mar 2008, at 07:27, AN@S wrote:

Thank you Frederick, I’m looking into this library, but does it
really require using a library to send a get request?

Yes. But it’s part of the standard ruby library and you won’t get very
far in general if you never use the ruby standard library.

Fred

On 3 Mar 2008, at 10:43, masch wrote:

Fred, did you make the SMS gateway? or Did you use an external
service?..

We use an external service.

Fred

Fred, did you make the SMS gateway? or Did you use an external
service?..

Salu2…

On Mon, Mar 3, 2008 at 4:39 AM, Frederick C.
[email protected]

On 3 Mar 2008, at 16:39, AN@S wrote:

username=xxxx&password=xxxx&mno=999999&msg=Hi from
above method?
It’s not impossible for someone in the right place at the right time
to snoop that username and password. There’s not a lot you can do
about that unless the people providing the service also provide https
access (or use some other mitigating scheme, eg only allowing requests
from certain ip addresses.

Fred

Hi,

I used the library, it is easier than what I expected,:


class Message < ActiveRecord::Base
def sendsms
require “net/http”
Net::HTTP.get_response(‘www.domain.com’,‘/sendsms/sendsms.asp?username=xxxx&password=xxxx&mno=999999&msg=Hi
from rails&Sid=xxxx&fl=0&mt=0’)
end

end


Now it works but is there any possibility that the URL could be exposed
in
a way or another to some bad user? Is there something like encrypting
the
URL or something? Or is it just safe to use the above method?

On 03/03/2008, Frederick C. [email protected] wrote:

On 3 Mar 2008, at 07:27, AN@S wrote:

On 02/03/2008, Frederick C. [email protected] wrote:
http://www.domain.com/sendsms/sendsms.asp?username=xxxx&password=xxxx&mno=999999&msg=xxx

I have the following scaffold-generated create method that

=> :created, :location => @message }
My question is: How can I transparently touch the gateway’s URL


Anas Marrawi
Visit me at: www.anasonline.net

For the record, all carriers have an email SMS system.

Sprint: [10-digit number]@messaging.sprintpcs.com
Cingular / ATT : [number]@txt.att.com

These services are of course free, and subject to limitations and
possibly delays. If you need to send a ton of SMSes out, or need
guarenteed quick delivery, you’ll need to look into an SMS gateway
service like clickatell.

Jason

Hi,

In case of sending Unicode messages I have to convert the message’s
characters to hexadecimal, I’ve looked into Ruby documentation but it
looks
like Ruby doesn’t have enough regarding to this issue. I’ve been
searching
for hours but didn’t find a perfect solution … do you have any
suggestion
guys?

Thank you very much for your helpful suggestions.

On 03/03/2008, Frederick C. [email protected] wrote:

end
It’s not impossible for someone in the right place at the right time

We use an external service.

Regards

I’m creating an application to send SMS messages, I got a
mobile number. A copy of the message should be stored in the
You need to have a look at the Net::HTTP libraries, which allows
@message = Message.new(params[:message])
=> :unprocessable_entity }


Anas Marrawi
Visit me at: www.anasonline.net

On Tue, 2008-03-04 at 09:43 -0500, Jason R. wrote:

For the record, all carriers have an email SMS system.

Sprint: [10-digit number]@messaging.sprintpcs.com
Cingular / ATT : [number]@txt.att.com

These services are of course free, and subject to limitations and
possibly delays. If you need to send a ton of SMSes out, or need
guarenteed quick delivery, you’ll need to look into an SMS gateway
service like clickatell.


add to that verizon…

[number]@vtext.com

Craig