HTTP Proxy supporting breakpoint through PHP
The HTTP protocol is only supported by the HTTP protocol. It does not support the HEADER redirection processing. Interested you can take a look ^ _ ^ Php / **************** ******************** / / * * / / * php http proxy * /// * version: 0.0.2 * // * last modify: 2005.1.12 * // * Author: Q3boy
Port ']. "/ n". $ Mixargv [0].': '. $ mixargv [1];} Return False;} Function GetError ($ enumreturntype = pp_error_code) {if ($ enumretURNTYPE == PP_ERROR_ALL) {Return Array (str_pad ($ this -> _ intError, 5, '0', STR_PAD_LEFT), $ this -> _ strError);} elseif ($ enumReturnType == PP_ERROR_MESSAGE) {Return $ this -> _ strError;} elseif ($ enumReturnType == PP_ERROR_CODE ) {RETURN $ THIS -> _ interror;} else {return false;}} function init ()}} function init () {$ this -> _ strurl = null; $ this -> _ arrargv = array (); $ this -> _ strref = null; $ this - >_ arrurl = array (); $ this -> _ relacket = null; $ this -> _ interror = 0; $ this -> _ strerror = 'there is no error'; // arrurl default $ this -> _ arrdefaultArrayURL = array ( 'protocol' => 'http', 'file' => 'Index.htm'); // Default port $ this -> _ arrdefaultport = array ('http' => '80'); return true;} Function seturl $ StrURL) { $ Strurl = Trim ($ StrURL); // Regular $ reg = "/ ^ (([/ w] ):)? ([^: | / / | @] *:)? ([^: | // | @] * @)? ([/ w | / - | /.] (// [^ /? | #] *)? (/? [^ #] *)? #. *)? $ / IS "; if (! preg_match ($ R, $ Strurl, $ arrurl) {Return $ this-> setError (1, $ StrURL);} else {// dismantling matching number list List $ TMP, $ TMP, $ Arr ['Protocol'], $ Arr ['User'], $ Arr ['Pass'], $ Arr [' Host '], $ Arr [' Port '], $ Arr [' Path '], $ arr [' query '], $ arr [' Anchor ']) =
$ arrurl; // Default protocol if (! $ arr [protocol ']) {$ arrrl [1] = $ this-> _ARRDEFAULTARRAYURL [' protocol '].': // ';} // set FileName $ ARR [ 'file'] = BaseName ($ Arr ['Path']); // Default Foreach ($ this -> _ arrdefaultArrayURL AS $ Key => $ VAL) {IF ($ ARR [$ Key] == ') { $ arr [$ key] = $ val;}} // default port if (is_null ($ this -> _ arrdefaultport [$ arr ['protocol'])) {Return $ this-> setError (2, $ arr [" Protocol ']);} elseif ($ arr [' port ']) {$ arr [' port '] = $ this -> _ arrdefaultport [$ arr [' protocol '];} // set URI $ Arr [' URI '] = ($ ARR [' Path ']? $ arr [' Path ']:' / '). ($ ARR [' Query ']?'? $ arr ['query']: ') $ ARR ['Anchor']? '#'. $ arr ['Anchor']: '); // Set URL UNSET ($ arrurl [0]); unset ($ arrurl [2]); $ this -> _ Strurl = Implode ('', $ arrurl); // set arrurl $ This -> _ arrUrl = $ arr; Return true;}} function getUrl ($ enumReturnType = PP_RETURN_ARRAY) {if ($ enumReturnType == PP_RETURN_STRING) {Return $ this -> _ strUrl;} elseif ($ enumReturnType == PP_RETURN_ARRAY) {Return $ this -> _ arrurl;} if ($ enumreturntype == pp_return_all) {Return Array ($ this -> _ strurl, $ this -> _ arrurl);} else {returnome
SetError (1001);}} Function setrefer ($ this -> _ strref = trim ($ strower); return true;} function getrefer () {RETURN $ THIS -> _ strref;} function getProxyurl ()} Function getProxyurl ()} _Server; list ($ strprocotol) = exPlode ('/', strtolower (TRIM ($ _ server ['server_protocol')))))))))))))); $ STR = STRPROCOTOL. ': //' $_server ['http_host']. $ _Server ['php_self']. '? U ='. Urlencode ($ this-> geturl). ($ This-> getrefer ()? ('& R ='. Urlencode ($ this-> getrefer ()) : ''); Return $ Str;} Function OpenSocket ()} Function OpenSocket () {$ Arr = $ this-> getURL (); $ this -> _RRSOCKET = @fsockopen ($ Arr ['Host'], $ Arr ['Port' ], $ INTERROR, $ STRERROR, 30); if (! $ this -> _RESSOCKET) {$ this -> _RESSSOCKET = NULL; RETURN $ this-> setError (3, Array ($ INTERROR, $ strrror);} Else {Return True;}} function getRequest () {RETURN $ this -> {'get'.Ucfirst ($ THIS -> _ arrurl ['protocol']). 'Request'} ();} Function Sendrequest () {Return Fwrite ($ this -> _RESSOCKET, $ this-> getRequest ());} function flushresponse ()} function flushresponse () {RETURN $ THIS -> {'flush'.ucfirst ($ this -> _ arrurl [' protocol ']).' response '} ();} function gethttpRequest () {$ arr = $ this-> getURL (); $ arRRequest = getAllHeaders ); $ ArRRequest ['Host'] = $ Arr ['Host']; $ strrequest = "get". $ Arr ['uri']. "Http / 1.1 / r / n";
Foreach ($ ARREQUEST AS $ Key => $ VAL) {$ strrequest. = "$ key: $ val / r / n";} $ strrequest. = "/ r / n"; return $ strrequest;} function flushhttpResponse () {$ Bolheader = true; while (! Feof ($ this -> _ limited)) {$ str = fgets ($ this -> _RESSOCKET, 4096); if ($ bolheader) {@Header ($ Str);} else {echo ($ STR);} IF ($ bolheader && $ str == "/ r / n") {$ bolheader = false; @Header ("content-type: Application / Gzip"); @Header ('Content-Disposition: Attachment; FileName = "'. $ this -> _ arrurl [' file '].'");}} return true;} function close () {fclose ($ this -> _ relassocket); $ this -> _ relassocket = null Return True;} Function Proxy ($ strurl = null, $ arrargv = array ()) {if (! Is_null ($ this-> geturl (pp_return_string)) && $ this-> OpenSocket () && $ this-> sendrequest ) && $ this-> Flushresp Onse ()) {echo (123); $ this-> close ();} else {return false;}}} f ($ strGetArrayName = '_get';} elseif (sizeof ($ http_get_vars) )) {$ StrGetArrayName = 'http_get_vars';} else {Die (' "HTML>" h> "Meta http-equiv = "content-type" content = "text / html">
Style Type = "Text / CSS"> stop> HEAD>