学习编程得第N天,发现一个超简单验证码短信接口对接DEMO示例
* Created by XadillaX on 14-2-12.
*https://github.com/XadillaX/ihuyi106js
*/
String.prototype.replaceAll = function(reallyDo, replaceWith, ignoreCase) {
if (!RegExp.prototype.isPrototypeOf(reallyDo)) {
return this.replace(new RegExp(reallyDo, (ignoreCase ? "gi": "g")), replaceWith);
} else {
return this.replace(reallyDo, replaceWith);
}
};
var dom = require('xmldom').DOMParser;
var _baseUri = "http://106.ihuyi.com/webservice/sms.php?method=Submit";
var _userAgent = "node-ihuyi106-module by 死月 (admin@xcoder.in)";
/**
* iHuyi constructure.
* @param account
* @param password 查看密码请登录用户中心->验证码、通知短信->帐户及签名设置->APIKEY
*/
var iHuyi = function(account, password) {
this.spidex = require("spidex");
this.spidex.setDefaultUserAgent(_userAgent);
this.account = account;
this.password = password;
};
/**
* send an SM