首页 > 编程 > ASP > 正文

Web代理(Asp版)

2024-05-04 11:02:51
字体:
来源:转载
供稿:网友
asp写Web代理软件,可以用作突破网关限制等,主要是为了配合Ajax使用的(因Firefox存在跨域访问的问题) 版本 0.1 作者 LlinZzi
功能
判断网站编码,支持任何语言
超连接自动转换
附带一个远程下载图片的函数
未解决问题,目前只能用来代理网站代码,图片等其他数据的代理转发尚未完成。
复制代码 代码如下:
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%>
<%Response.Charset = "utf-8"%>
<%
Server.ScriptTimeout=9999999;

var Surl = String(Request.QueryString("url"));
if(Surl == "undefined"){
Response.Write("<p style=/"font-size:9pt;margin:30px;padding:10px;text-align:center;background-color:#FFCCCC;border: 1px solid #999999;/">Asp代理 by Llinzzi</p>");
Response.Write("<div style=/"font-size:9pt;margin:30px;text-align:center;background-color:#FFFFCC;border: 1px solid #999999;/">");
Response.Write("<form action=/"#/" method=/"get/" >");
Response.Write("<p style=/"font-size:9pt;margin:5px;text-align:center;/">请输入网址</p>");
Response.Write("<p><input style=/"background-color: #FFCCCC;border: 1px solid #999999;/" type=/"text/" name=/"url/"></p>");
Response.Write("<p><input style=/"background-color: #FFCCCC;border: 1px solid #999999;/" type=/"submit/"  value=/"GoWeb/"></p>");
Response.Write("</div>");
}
else if(Surl == ""){
Response.Write("<p style=/"font-size:9pt;margin:30px;padding:10px;text-align:center;background-color:#FFCCCC;border: 1px solid #999999;/">Asp代理 by Llinzzi</p>");
Response.Write("<div style=/"font-size:9pt;margin:30px;text-align:center;background-color:#FFFFCC;border: 1px solid #999999;/">");
Response.Write("<p>地址为空,请格式输入 如 www.tom.com </p>");
Response.Write("</div>");
}
else{
Surl = (Surl.substr(0,7) != "http://") ? "http://"+Surl : Surl;
Response.Write(send_request(Surl));
}

function send_request(url) {
    var codedtext;
    http_request = Server.CreateObject("Microsoft.XMLHTTP");
    try{
    http_request.Open("GET",url,false);
    http_request.Send(null);
    }
    catch(e)
    {
    Response.Write(e.description);
    }
    if (http_request.ReadyState == 4){
        //自动判断编码开始
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表