# Sending SMS messages through Proxy Server

**URL:** <https://www.ruby-forum.com/t/sending-sms-messages-through-proxy-server/259712>\
**Category:** Uncategorized\
**Created:** [June 2, 2020, 12:52pm UTC](https://www.ruby-forum.com/t/sending-sms-messages-through-proxy-server/259712 "2020-06-02T12:52:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nikname](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e56c9b/32.png) [@nikname](https://www.ruby-forum.com/u/nikname)\
**Post date:** [June 2, 2020, 12:52pm UTC](https://www.ruby-forum.com/t/sending-sms-messages-through-proxy-server/259712/1 "2020-06-02T12:52:01Z")

</div>

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://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](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

---

<div class="post-metadata">

**Author:** ![Maniac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/13edae/32.png) [@Maniac](https://www.ruby-forum.com/u/Maniac)\
**Post date:** [December 20, 2020, 9:04pm UTC](https://www.ruby-forum.com/t/sending-sms-messages-through-proxy-server/259712/2 "2020-12-20T21:04:30Z")

</div>

Hello @nikname,

If you still need help, I would recommend you to check this blog post:  
[https://www.fedux.org/articles/2015/04/11/setup-a-proxy-with-ruby.html](https://www.fedux.org/articles/2015/04/11/setup-a-proxy-with-ruby.html)

I think it will help you understand how you can do it yourself.
