Skip to content

Instantly share code, notes, and snippets.

@johannesl
Created March 25, 2014 13:56
Show Gist options
  • Select an option

  • Save johannesl/9762369 to your computer and use it in GitHub Desktop.

Select an option

Save johannesl/9762369 to your computer and use it in GitHub Desktop.

Revisions

  1. johannesl created this gist Mar 25, 2014.
    17 changes: 17 additions & 0 deletions Send SMS with 46elks from Ruby
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    require 'net/http'

    uri = URI('https://api.46elks.com/a1/SMS')
    req = Net::HTTP::Post.new(uri)
    req.basic_auth 'u12341234123412341234123412341234', 'ABCDABCDABCDABCDABCDABCDABCDABCD'
    req.set_form_data(
    :from => 'SenderName',
    :to => '+46704508449',
    :message => 'Login code 123456',
    :flashsms => 'yes'
    )

    res = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
    http.request req
    end

    puts res.body