It’s not easy to write this ruby – nethttp SMS verification code interface with tears

Time:2021-10-23

The adult world has never been easy. Life is like this, and so is the code. Due to the needs of the project, I wrote a code for Ruby – nethttp access SMS verification code interface. I didn’t expect to say that the price of the SMS service provider of my interface is too expensive.

Helpless, through his intelligence, he finally found a low-cost and stable SMS provider in major cloud markets ~ but he broke his cow~

Let’s share the code I wrote:

`require “uri”
require “net/http”

url = URI(“https://vip.veesing.com/smsApi/verifyCode”)

https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request[“Content-Type”] = “application/x-www-form-urlencoded;charset=utf-8”
request.body = “appId=41KYR0EB&appKey=IIWCKKSR7NOQ&phone=1561894**&templateId=1043&variables=1234″

response = https.request(request)
puts response.read_body
`
This thing tells us a truth that the verification code interface should not be randomly connected, which is likely to be useless.

Ruby – nethttp.rb and documentation Download