Sending SMS messages through Proxy Server

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

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


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 =,uri.port)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE

req =, initheader = {‘Content-Type’ =>‘application/json’})

req.basic_auth ‘Bank’, ‘Bank_BY’

SMS = {
“phone_number”: “#{Number}”,
“extra_id”: “774”,
“callback_url”: “”,
“tag”: “Bank”,
“channels”: [
“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


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