Created
October 22, 2012 08:41
-
-
Save jonas8/3930378 to your computer and use it in GitHub Desktop.
sms send (rails demo)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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