DDR爱好者之家 Design By 杰米
smart.asp
复制代码 代码如下:
<script language="jscript" runat="server">
/*
在VBS里面的调用方法
dim myhttp
set myhttp = SmartHttp(url,method,data); //三个参数均可选
属性:
url:String,请求的URL地址
method:String,请求的方法
data:String,请求的数据
charset:String,请求的URL返回数据的编码
status:Int,请求返回的状态码
readyState:Int,同HTTP请求的当前通讯状态,1、2、3、4
dataset:Object,请求的数据,如果增加了,会将这部分数据附加到data属性
dataset属性:
charset:String,发送数据的编码
dataset方法:
append(key,value,noencode):添加数据
remove(key):移除某个数据项
isexists(key):判断某个数据项是不是存在
clear:清除所有数据项
方法:
header(headstr):设置请求头,项和值之间用:分开
timeout(t1,t2,t3,t4):设置超时时间
send():发送请求
getbinary:获取服务器返回的二进制数据
gettext(charset):获取指定编码的文本
getjson(charset):获取指定编码的json数据
getheader(key):获取服务器返回的响应头
getxml(charset):获取指定编码的xml数据
*/
function SmartHttp(url,method,data){
return new _SmartHttp(url,method,data);
}
function _SmartHttp(url,method,data){
if(typeof method=="undefined") method="GET";
if(typeof data=="undefined") data="";
method = method.toUpperCase();
method = method!="POST" ? "GET" : "POST";
this.timeout=[10000,10000,10000,10000];
this.method = method;
this.url=url;
this.data=data;
this.charset="gb2312";
this.http=null;
this.headers=[];
this.status=0;
this.readyState=0;
this.content=null;
this.msg="";
this.dataset={
charset:"gb2312",
data:[],
append:function(key,value,noencode){
var fn=null;
if(this.charset.toLowerCase()=="utf-8"){fn = encodeURIComponent;}else{fn = escape;}
if(noencode==true){fn=function(_str){return _str;}}
this.data.push({"key":fn(key),"value":fn(value)});
},
remove:function(key){
if(this.data.length<=0) return false;
var _data=[];
for(var i=0;i<this.data.length;i++){
if(this.data[i].key!=key){
_data.push(this.data[i]);
}
}
this.data = _data;
},
isexists:function(key){
if(this.data.length<=0) return false;
for(var i=0;i<this.data.length;i++){
if(this.data[i].key==key){
return true;
}
}
return false;
},
clear:function(){
this.dataset.data=[];
}
};
}
_SmartHttp.prototype.init=function(){
var datasetstr="";
if(this.dataset.data.length>0){
for(var i=0;i<this.dataset.data.length;i++){
datasetstr += this.dataset.data[i].key + "=" + this.dataset.data[i].value + "&";
}
}
if(datasetstr!="") datasetstr = datasetstr.substr(0,datasetstr.length-1);
if(this.data==""){this.data = datasetstr;}else{if(datasetstr!="")this.data+= "&" + datasetstr;}
if(this.data=="")this.data=null;
//this.url += ((this.url.indexOf("?")<0) ? "?" : "&") + "jornd=" + this.getrnd();
if(this.method=="GET" && this.data!=null) this.url += "&" + this.data;
if(this.method=="POST") this.headers.push("Content-Type:application/x-www-form-urlencoded");
if(!this.charset || this.charset=="") this.charset = "gb2312";
};
_SmartHttp.prototype.header=function(headstr){
if(headstr.indexOf(":")>=0) this.headers.push(headstr);
return this;
};
_SmartHttp.prototype.timeout=function(){
if(arguments.length>4){return this;}
for(var i =0;i<arguments.length;i++){
if(!isNaN(arguments[i])){
this.timeout[i] = parseInt(arguments[i]);
}
}
return this;
};
_SmartHttp.prototype.send=function(){
this.init();
var _http = this.getobj();
if(_http==null){return this;}
try{
_http.setTimeouts(this.timeout[0], this.timeout[1], this.timeout[2], this.timeout[3]);
}catch(ex){}
_http.open(this.method,this.url,false);
if(this.headers.length>0){
for(var i=0;i<this.headers.length;i++){
var Sindex = this.headers[i].indexOf(":");
var key = this.headers[i].substr(0,Sindex);
var value = this.headers[i].substr(Sindex+1);
_http.setRequestHeader(key,value);
}
}
_http.send(this.data);
this.readyState = _http.readyState;
if(_http.readyState==4){
this.status = parseInt(_http.status);
this.http = _http;
this.content = _http.responseBody;
}
return this;
}
_SmartHttp.prototype.getbinary=function(){
return this.content;
};
_SmartHttp.prototype.gettext=function(charset){
try{
return this.b2s(this.content,charset ? charset : this.charset);
}catch(ex){
this.msg = ex.description;
return "";
}
};
_SmartHttp.prototype.getjson=function(charset){
try{
var _json=null;
eval("_json=(" + this.gettext(charset) + ");");
return _json;
}catch(ex){
this.msg = ex.description;
return null;
}
};
_SmartHttp.prototype.getheader=function(key){
if(key){
if(key.toUpperCase()=="SET-COOKIE"){
key = key.replace("-","\-");
var headers = this.http.getAllResponseHeaders();
var regexp = new RegExp("\n" + key + "\:(.+?)\r","ig");
var resstr = "";
while((res = regexp.exec(headers))!=null){
var val = res[1].trim();
resstr = resstr + val.substr(0,val.indexOf(";")) + "; "
}
if(resstr!=""){
resstr = resstr.substr(0,resstr.lastIndexOf(";"));
}
return resstr;
}else{
return this.http.getResponseHeader(key);
}
}else{return this.http.getAllResponseHeaders();}
};
_SmartHttp.prototype.getxml=function(charset){
try{
var _dom = new ActiveXObject("MSXML2.DOMDocument");
_dom.loadXML(this.gettext(charset));
return _dom;
}catch(ex){
this.msg = ex.description;
return null;
}
};
_SmartHttp.prototype.getobj = function (){
var b=null;
var httplist = ["MSXML2.serverXMLHttp.3.0","MSXML2.serverXMLHttp","MSXML2.XMLHttp.3.0","MSXML2.XMLHttp","Microsoft.XMLHttp"];
for(var i = 0;i<=httplist.length -1;i++){
try{
b= new ActiveXObject(httplist[i]);
(function(o){
_SmartHttp.prototype.getobj = function(){return new ActiveXObject(o)};
})(httplist[i]);
return b;
}catch(ex){
eval("this.msg = ex.description;");
}
}
return b;
};
_SmartHttp.prototype.getrnd = function (){return Math.random().toString().substr(2);};
_SmartHttp.prototype.b2s = function(bytSource, Cset){ //ef bb bf,c0 fd
var Objstream,c1,c2,c3;
var byts;
Objstream =Server.CreateObject("ADODB.Stream");
Objstream.Type = 1;
Objstream.Mode = 3;
Objstream.Open();
Objstream.Write(bytSource);
Objstream.Position = 0;
Objstream.Type = 2;
Objstream.CharSet = Cset;
byts = Objstream.ReadText();
Objstream.Close();
Objstream = null;
return byts;
};
_SmartHttp.prototype.urlencode=function(str){ return encodeURIComponent(str);};
_SmartHttp.prototype.urldecode=function(str){ return decodeURIComponent(str);};
String.prototype.trim = function(){return this.replace(/(^(\s+)|(\s+)$)/igm,"");};
</script>
使用代码:
复制代码 代码如下:
<!--#include file="smart.asp"-->
<%
Response.charset="utf-8"
dim url,method,data,charset
url =Request.Form("targeturl")
method =Request.Form("method")
data =Request.Form("data")
charset = Request.Form("charset")
if charset = "" then charset = "GB2312"
response.Write SmartHttp(url,method,data).send().gettext(charset)
set myhttp = nothing
%>
代码打包下载
复制代码 代码如下:
<script language="jscript" runat="server">
/*
在VBS里面的调用方法
dim myhttp
set myhttp = SmartHttp(url,method,data); //三个参数均可选
属性:
url:String,请求的URL地址
method:String,请求的方法
data:String,请求的数据
charset:String,请求的URL返回数据的编码
status:Int,请求返回的状态码
readyState:Int,同HTTP请求的当前通讯状态,1、2、3、4
dataset:Object,请求的数据,如果增加了,会将这部分数据附加到data属性
dataset属性:
charset:String,发送数据的编码
dataset方法:
append(key,value,noencode):添加数据
remove(key):移除某个数据项
isexists(key):判断某个数据项是不是存在
clear:清除所有数据项
方法:
header(headstr):设置请求头,项和值之间用:分开
timeout(t1,t2,t3,t4):设置超时时间
send():发送请求
getbinary:获取服务器返回的二进制数据
gettext(charset):获取指定编码的文本
getjson(charset):获取指定编码的json数据
getheader(key):获取服务器返回的响应头
getxml(charset):获取指定编码的xml数据
*/
function SmartHttp(url,method,data){
return new _SmartHttp(url,method,data);
}
function _SmartHttp(url,method,data){
if(typeof method=="undefined") method="GET";
if(typeof data=="undefined") data="";
method = method.toUpperCase();
method = method!="POST" ? "GET" : "POST";
this.timeout=[10000,10000,10000,10000];
this.method = method;
this.url=url;
this.data=data;
this.charset="gb2312";
this.http=null;
this.headers=[];
this.status=0;
this.readyState=0;
this.content=null;
this.msg="";
this.dataset={
charset:"gb2312",
data:[],
append:function(key,value,noencode){
var fn=null;
if(this.charset.toLowerCase()=="utf-8"){fn = encodeURIComponent;}else{fn = escape;}
if(noencode==true){fn=function(_str){return _str;}}
this.data.push({"key":fn(key),"value":fn(value)});
},
remove:function(key){
if(this.data.length<=0) return false;
var _data=[];
for(var i=0;i<this.data.length;i++){
if(this.data[i].key!=key){
_data.push(this.data[i]);
}
}
this.data = _data;
},
isexists:function(key){
if(this.data.length<=0) return false;
for(var i=0;i<this.data.length;i++){
if(this.data[i].key==key){
return true;
}
}
return false;
},
clear:function(){
this.dataset.data=[];
}
};
}
_SmartHttp.prototype.init=function(){
var datasetstr="";
if(this.dataset.data.length>0){
for(var i=0;i<this.dataset.data.length;i++){
datasetstr += this.dataset.data[i].key + "=" + this.dataset.data[i].value + "&";
}
}
if(datasetstr!="") datasetstr = datasetstr.substr(0,datasetstr.length-1);
if(this.data==""){this.data = datasetstr;}else{if(datasetstr!="")this.data+= "&" + datasetstr;}
if(this.data=="")this.data=null;
//this.url += ((this.url.indexOf("?")<0) ? "?" : "&") + "jornd=" + this.getrnd();
if(this.method=="GET" && this.data!=null) this.url += "&" + this.data;
if(this.method=="POST") this.headers.push("Content-Type:application/x-www-form-urlencoded");
if(!this.charset || this.charset=="") this.charset = "gb2312";
};
_SmartHttp.prototype.header=function(headstr){
if(headstr.indexOf(":")>=0) this.headers.push(headstr);
return this;
};
_SmartHttp.prototype.timeout=function(){
if(arguments.length>4){return this;}
for(var i =0;i<arguments.length;i++){
if(!isNaN(arguments[i])){
this.timeout[i] = parseInt(arguments[i]);
}
}
return this;
};
_SmartHttp.prototype.send=function(){
this.init();
var _http = this.getobj();
if(_http==null){return this;}
try{
_http.setTimeouts(this.timeout[0], this.timeout[1], this.timeout[2], this.timeout[3]);
}catch(ex){}
_http.open(this.method,this.url,false);
if(this.headers.length>0){
for(var i=0;i<this.headers.length;i++){
var Sindex = this.headers[i].indexOf(":");
var key = this.headers[i].substr(0,Sindex);
var value = this.headers[i].substr(Sindex+1);
_http.setRequestHeader(key,value);
}
}
_http.send(this.data);
this.readyState = _http.readyState;
if(_http.readyState==4){
this.status = parseInt(_http.status);
this.http = _http;
this.content = _http.responseBody;
}
return this;
}
_SmartHttp.prototype.getbinary=function(){
return this.content;
};
_SmartHttp.prototype.gettext=function(charset){
try{
return this.b2s(this.content,charset ? charset : this.charset);
}catch(ex){
this.msg = ex.description;
return "";
}
};
_SmartHttp.prototype.getjson=function(charset){
try{
var _json=null;
eval("_json=(" + this.gettext(charset) + ");");
return _json;
}catch(ex){
this.msg = ex.description;
return null;
}
};
_SmartHttp.prototype.getheader=function(key){
if(key){
if(key.toUpperCase()=="SET-COOKIE"){
key = key.replace("-","\-");
var headers = this.http.getAllResponseHeaders();
var regexp = new RegExp("\n" + key + "\:(.+?)\r","ig");
var resstr = "";
while((res = regexp.exec(headers))!=null){
var val = res[1].trim();
resstr = resstr + val.substr(0,val.indexOf(";")) + "; "
}
if(resstr!=""){
resstr = resstr.substr(0,resstr.lastIndexOf(";"));
}
return resstr;
}else{
return this.http.getResponseHeader(key);
}
}else{return this.http.getAllResponseHeaders();}
};
_SmartHttp.prototype.getxml=function(charset){
try{
var _dom = new ActiveXObject("MSXML2.DOMDocument");
_dom.loadXML(this.gettext(charset));
return _dom;
}catch(ex){
this.msg = ex.description;
return null;
}
};
_SmartHttp.prototype.getobj = function (){
var b=null;
var httplist = ["MSXML2.serverXMLHttp.3.0","MSXML2.serverXMLHttp","MSXML2.XMLHttp.3.0","MSXML2.XMLHttp","Microsoft.XMLHttp"];
for(var i = 0;i<=httplist.length -1;i++){
try{
b= new ActiveXObject(httplist[i]);
(function(o){
_SmartHttp.prototype.getobj = function(){return new ActiveXObject(o)};
})(httplist[i]);
return b;
}catch(ex){
eval("this.msg = ex.description;");
}
}
return b;
};
_SmartHttp.prototype.getrnd = function (){return Math.random().toString().substr(2);};
_SmartHttp.prototype.b2s = function(bytSource, Cset){ //ef bb bf,c0 fd
var Objstream,c1,c2,c3;
var byts;
Objstream =Server.CreateObject("ADODB.Stream");
Objstream.Type = 1;
Objstream.Mode = 3;
Objstream.Open();
Objstream.Write(bytSource);
Objstream.Position = 0;
Objstream.Type = 2;
Objstream.CharSet = Cset;
byts = Objstream.ReadText();
Objstream.Close();
Objstream = null;
return byts;
};
_SmartHttp.prototype.urlencode=function(str){ return encodeURIComponent(str);};
_SmartHttp.prototype.urldecode=function(str){ return decodeURIComponent(str);};
String.prototype.trim = function(){return this.replace(/(^(\s+)|(\s+)$)/igm,"");};
</script>
使用代码:
复制代码 代码如下:
<!--#include file="smart.asp"-->
<%
Response.charset="utf-8"
dim url,method,data,charset
url =Request.Form("targeturl")
method =Request.Form("method")
data =Request.Form("data")
charset = Request.Form("charset")
if charset = "" then charset = "GB2312"
response.Write SmartHttp(url,method,data).send().gettext(charset)
set myhttp = nothing
%>
代码打包下载
DDR爱好者之家 Design By 杰米
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
DDR爱好者之家 Design By 杰米
暂无评论...
《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线
暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。
艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。
《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。
更新日志
2024年11月24日
2024年11月24日
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]