编程知识 cdmana.com

With tears, I wrote this ruby - nethttp SMS verification code interface. It's not easy

The adult world has never been easy , Life is like this , So is the code , Because of the needs of the project , I wrote one Ruby - NetHTTP Access to SMS verification code interface code , I didn't expect to say that the SMS service provider of my docking interface is too expensive .

Have no alternative , Through one's own intelligence , Finally, in the big cloud market to find a low price and stable SMS provider ~ But I've done a lot of damage to my own cattle ~

Now let's share my code with you :

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 , Do not connect captcha interface randomly , It's probably not working .

Ruby - NetHTTP.rb And document description download

版权声明
本文为[To work is to master people]所创,转载请带上原文链接,感谢

Scroll to Top