標籤:
前序工作:添加項目,給賬戶充錢
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
手機驗證碼解決方案