The adult world is never easy, so is the life, so is the code. Due to the requirements of the project, I wrote a code to access the SMS verification code interface of Ruby – NetHttp, but I did not expect to say that the price of the SMS service provider of the interface I was docking was too expensive.
Unfortunately, through my own intelligence, I finally found a low price and stable SMS provider in the major cloud market ~ can be criticized by my own
Here is 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 ‘tells us that the CAPTCHA interface should not be randomly connected because it is probably useless.
Ruby – nethttp. rb and documentation for download