Web Proxy (ASP)

Source: Internet
Author: User

ASP writes Web Proxy software and can be used to break through gateway restrictions. It is mainly used in combination with Ajax (due to cross-origin access issues in Firefox). llinzzi, author of version 0.1
Function
Determine website code, supporting any language
Automatic conversion of hyperconnections
Comes with a function for remote image download.
The problem persists. Currently, it can only be used as a proxy for websites. Code , Images and other data proxy forwarding has not been completed. Copy code The Code is 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 proxy 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; \ "> enter the 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 proxy 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> the address is blank. Please enter the format, for example, 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 ){
// Automatically determines the start of Encoding
VaR charresult = http_request.responsetext.match (/charset = (\ s +) "/I );
If (charresult! = NULL ){
VaR cset = charresult [1];
} Else {cset = "UTF-8 "}
// Automatically determines the end Of the Encoding
Codedtext = bytestobstr (http_request.responsebody, cset );
} Else {
Codedtext = "erro ";
}
// Replace the hyperconnection
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", "http://www.baidu.com/img/logo.gif ");
%>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.