8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/sms_bao.rb', line 8
def self.send(user_name, password, phones, content)
result = nil
password = Digest::MD5.hexdigest password
begin
open("http://www.smsbao.com/sms?u=inruby&p=#{password}&m=#{phones}&c=#{URI.escape(content)}") {|f|
f.each_line {|line| result = line}
}
rescue => ex
return ex.message
end
case result
when '0'
'success'
when '30'
'password error'
when '40'
'bad account'
when '41'
'no money'
when '42'
'account expired'
when '43'
'IP denied'
when '50'
'content sensitive'
when '51'
'bad phone number'
else
'unknown error'
end
end
|