标签:
前序工作:添加项目,给账户充钱
require ‘net/http‘
url = URI.parse(‘http://116.255.240.184/do.aspx‘)
response = Net::HTTP.post_form(url,{‘action‘ => ‘loginIn‘,‘uid‘=>‘1‘,‘pwd‘=>‘1‘}) #登录 函数 ,用户名,密码
puts response.body
token= response.body.split(‘|‘)[1]
puts token
response = Net::HTTP.post_form(url,{‘action‘ => ‘cancelSMSRecvAll‘,‘uid‘=>‘1‘,‘token‘=>token}) #取消一个短信接收,可立即解锁被锁定的金额 返回的token ,用户名
puts response.body
response = Net::HTTP.post_form(url,{‘action‘ => ‘getMobilenum‘,‘pid‘=>‘511‘,‘uid‘=>‘1‘,‘token‘=>token}) #得到手机 ,项目编号,用户名,token
puts response.body
tel= response.body.split(‘|‘)[0] #tel=‘13434493096‘ #输入手机到****获取验证码,然后等待10秒再去获取
sleep 10
response = Net::HTTP.post_form(url,{‘action‘ => ‘getVcodeAndReleaseMobile‘,‘mobile‘=>tel,‘token‘=>token,‘uid‘=>‘1‘}) #得到验证码
while response.body=="not_receive"
response = Net::HTTP.post_form(url,{‘action‘ => ‘getVcodeAndReleaseMobile‘,‘mobile‘=>tel,‘token‘=>token,‘uid‘=>‘1‘})
sleep 1
puts "not_receive"
end
puts response.body 这样就得到了相关验证码
运行产生的信息
C:\RailsInstaller\Ruby1.9.3\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) D:/Documents/RubymineProjects/untitled/post.rb
a4727603|e01034b93982fa900f650f536cb4b2dc
e01034b93982fa900f650f536cb4b2dc
1
18318624721|f7adee988bfaf74eb0222d8459fcf8b7
not_receive
not_receive
not_receive
10657521833285514|尊敬的玩家:您的注册验证码为:776558,验证码将于3分钟后失效。【多多游戏】
Process finished with exit code 0
标签:
原文地址:http://www.cnblogs.com/tester-huang/p/4632418.html