Skip to content

Instantly share code, notes, and snippets.

@jonas8
Created October 22, 2012 08:41
Show Gist options
  • Select an option

  • Save jonas8/3930378 to your computer and use it in GitHub Desktop.

Select an option

Save jonas8/3930378 to your computer and use it in GitHub Desktop.
sms send (rails demo)
conn = Faraday.new(:url => 'http://ip:8022/') do |faraday|
faraday.request :url_encoded
faraday.response :logger
faraday.adapter Faraday.default_adapter
end
response = conn.get 'proxyclient01/sendSms.ashx', {:cid => Base64.encode64('username'),
:pwd => Base64.encode64('password'),
:mobile => Base64.encode64(mobile),
:content => Base64.encode64(sms_content),
:lcode => '',
:ssid => Time.now.to_i,
:format => 32,
:sign => '',
:custom => ''
}# All params above are required
if response.body =~ /10000/
render :text => "发送成功"
else
render :text => "发送失败"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment