ASP write Web proxy software, can be used as a breakthrough gateway restrictions, etc., mainly to match Ajax use (because Firefox has cross-domain access issues) version 0.1 author Llinzzi
Function
Judge the website code, support any language
Hyper-Connection Automatic conversion
A function that comes with a remote download picture
Unresolved issues, currently can only be used to proxy site code, pictures and other data agent forwarding has not completed.
Copy Code code as follows:
<% @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 Agent 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;\ "> Please enter URL </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 Agent 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> address is blank, please format input such as 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) {
Automatic Judgment Coding Start
var charresult = http_request. Responsetext.match (/charset= (\s+) "I/I);
if (Charresult!= null) {
var Cset = charresult[1];
}else{cset = "Utf-8"}
Automatic Judgment Coding End
Codedtext = Bytestobstr (http_request. Responsebody,cset);
}else{
Codedtext = "Erro";
}
Replace a super connection
Codedtext = Codedtext.replace (/href= "\/?/ig", "href=\" "+url+"/");
Codedtext = Codedtext.replace (/(<a.*href= ")/ig," $1servergate.asp?url= ");
return (Codedtext);
}
function Bytestobstr (body,cset) {
Var objstream;
objstream = Server.CreateObject ("ADODB.stream");
Objstream. Type = 1;
Objstream. Mode = 3;
Objstream. Open ();
Objstream. Write (body);
Objstream. Position = 0;
Objstream. Type = 2;
Objstream. Charset = Cset;
Bytestobstr = objstream. Readtext;
Objstream. Close;
return (BYTESTOBSTR);
}
function Saveremotefile (localfilename,remotefileurl) {
var retrieval,ads;
Retrieval = Server.CreateObject ("Microsoft.XMLHTTP");
Retrieval.open ("Get", remotefileurl,false);
Retrieval.send (NULL);
if (retrieval.readystate = = 4) {
Ads = Server.CreateObject ("ADODB.stream");
Ads.type = 1;
Ads.open ();
Ads.write (Retrieval.responsebody);
Ads.savetofile (Server.MapPath (LocalFilename), 2);
Ads.cancel;
Ads.close;
}
}
Saveremotefile ("Aa.gif", "yun_qi_img/logo.gif");
%>