Sending SMS messages through Proxy Server

Hello.
Help me. I have proxy server 10.10.10.5 (Login, Password).

Without a proxy server, the script works. I do not know how to integrate data transfer through a proxy server.

Blockquote

puts “Verification of sending SMS messages through the mobile operator ‘MTS Belarus’.”

print "Alpha Name: "
Alpha = gets.chomp

print “Number (375xxxxxxxxx):”
Number = gets.chomp

print "Texts: "
Texts = gets.chomp

require ‘net/http’
require ‘json’
require ‘net/https’
require ‘uri’

uri = URI(‘https://apir.connect.mts.by/774/json3/simple’)
https = Net::HTTP.new(uri.host,uri.port)
https.use_ssl=true
https.verify_mode = OpenSSL::SSL::VERIFY_NONE

req = Net::HTTP::Post.new(uri.path, initheader = {‘Content-Type’ =>‘application/json’})

req.basic_auth ‘Bank’, ‘Bank_BY’

SMS = {
“phone_number”: “#{Number}”,
“extra_id”: “774”,
“callback_url”: “https://send-dr-here.com”,
“tag”: “Bank”,
“channels”: [
“sms”
],
“channel_options”: {
“sms”: {
“text”: “#{Texts}”,
“alpha_name”: “#{Alpha}”,
“ttl”: 600
}
}
}

req.body = SMS.to_json
res = https.request(req)

p res.body
p res.code

Blockquote

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs