全球主机交流论坛

标题: 有没有网页代理源码? [打印本页]

作者: yilin101    时间: 2016-12-30 16:16
标题: 有没有网页代理源码?
就是一个网页  输入google 可以在这个网页中上网代理


作者: yilin101    时间: 2016-12-30 16:17
http://fengherili.cc/  就是这样的
作者: 阿威    时间: 2016-12-30 16:18
带宽和内存需求很高,否则代理极慢
作者: yilin101    时间: 2016-12-30 16:20
阿威 发表于 2016-12-30 16:18
带宽和内存需求很高,否则代理极慢

我自己用 给一个长辈 他想看国外新闻 但是电脑不太会用
我想弄一个 让他自己输入域名直接就能打开 不需要太多操作
作者: Gengsir    时间: 2016-12-30 16:22
glype lz可以试试
作者: 爱国者捣蛋    时间: 2016-12-30 16:24
就是glype,很久前还有个phpproxy不过很少用了
你给老人搭个反代多省事
作者: 阿威    时间: 2016-12-30 16:25
本帖最后由 阿威 于 2016-12-30 16:27 编辑
yilin101 发表于 2016-12-30 16:20
我自己用 给一个长辈 他想看国外新闻 但是电脑不太会用
我想弄一个 让他自己输入域名直接就能打开 不需 ...


还是不太建议直接输入网址代理,需要翻哪些网站?

推荐一下这个项目:https://github.com/aploium/zmirror
非传统反代,具体看readme,支持gmail  可以直接看ytb视频

其实需要的操作并不多,手动配置一下一劳永逸

几个样站
https://g.wo.ci/
https://ytb.wo.ci
作者: yilin101    时间: 2016-12-30 16:56
爱国者捣蛋 发表于 2016-12-30 16:24
就是glype,很久前还有个phpproxy不过很少用了
你给老人搭个反代多省事

反代试过了。那个新闻网站 各种域名链接 没法用
作者: yilin101    时间: 2016-12-30 17:00
阿威 发表于 2016-12-30 16:25
还是不太建议直接输入网址代理,需要翻哪些网站?

推荐一下这个项目:https://github.com/aploium/zmirr ...

研究下 谢谢
作者: 薅羊毛    时间: 2016-12-30 17:04
这种容易被滥用 还是 来 SS 吧
作者: llsilver    时间: 2016-12-30 17:04
自己改个input框出来就行了,无需手动传参

  1. <?PHP

  2. // Change these configuration options if needed, see above descriptions for info.
  3. $enable_jsonp    = false;
  4. $enable_native   = false;
  5. $valid_url_regex = '/.*/';

  6. // ############################################################################

  7. $url = $_GET['url'];

  8. if ( !$url ) {
  9.   
  10.   // Passed url not specified.
  11.   $contents = 'ERROR: url not specified';
  12.   $status = array( 'http_code' => 'ERROR' );
  13.   
  14. } else if ( !preg_match( $valid_url_regex, $url ) ) {
  15.   
  16.   // Passed url doesn't match $valid_url_regex.
  17.   $contents = 'ERROR: invalid url';
  18.   $status = array( 'http_code' => 'ERROR' );
  19.   
  20. } else {
  21.   $ch = curl_init( $url );
  22.   
  23.   if ( strtolower($_SERVER['REQUEST_METHOD']) == 'post' ) {
  24.     curl_setopt( $ch, CURLOPT_POST, true );
  25.     curl_setopt( $ch, CURLOPT_POSTFIELDS, $_POST );
  26.   }
  27.   
  28.   if ( $_GET['send_cookies'] ) {
  29.     $cookie = array();
  30.     foreach ( $_COOKIE as $key => $value ) {
  31.       $cookie[] = $key . '=' . $value;
  32.     }
  33.     if ( $_GET['send_session'] ) {
  34.       $cookie[] = SID;
  35.     }
  36.     $cookie = implode( '; ', $cookie );
  37.    
  38.     curl_setopt( $ch, CURLOPT_COOKIE, $cookie );
  39.   }
  40.   
  41.   curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
  42.   curl_setopt( $ch, CURLOPT_HEADER, true );
  43.   curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
  44.   
  45.   curl_setopt( $ch, CURLOPT_USERAGENT, $_GET['user_agent'] ? $_GET['user_agent'] : $_SERVER['HTTP_USER_AGENT'] );
  46.   
  47.   list( $header, $contents ) = preg_split( '/([\r\n][\r\n])\\1/', curl_exec( $ch ), 2 );
  48.   
  49.   $status = curl_getinfo( $ch );
  50.   
  51.   curl_close( $ch );
  52. }

  53. // Split header text into an array.
  54. $header_text = preg_split( '/[\r\n]+/', $header );

  55. if ( $_GET['mode'] == 'native' ) {
  56.   if ( !$enable_native ) {
  57.     $contents = 'ERROR: invalid mode';
  58.     $status = array( 'http_code' => 'ERROR' );
  59.   }
  60.   
  61.   // Propagate headers to response.
  62.   foreach ( $header_text as $header ) {
  63.     if ( preg_match( '/^(?:Content-Type|Content-Language|Set-Cookie):/i', $header ) ) {
  64.       header( $header );
  65.     }
  66.   }
  67.   
  68.   print $contents;
  69.   
  70. } else {
  71.   
  72.   // $data will be serialized into JSON data.
  73.   $data = array();
  74.   
  75.   // Propagate all HTTP headers into the JSON data object.
  76.   if ( $_GET['full_headers'] ) {
  77.     $data['headers'] = array();
  78.    
  79.     foreach ( $header_text as $header ) {
  80.       preg_match( '/^(.+?):\s+(.*)$/', $header, $matches );
  81.       if ( $matches ) {
  82.         $data['headers'][ $matches[1] ] = $matches[2];
  83.       }
  84.     }
  85.   }
  86.   
  87.   // Propagate all cURL request / response info to the JSON data object.
  88.   if ( $_GET['full_status'] ) {
  89.     $data['status'] = $status;
  90.   } else {
  91.     $data['status'] = array();
  92.     $data['status']['http_code'] = $status['http_code'];
  93.   }
  94.   
  95.   // Set the JSON data object contents, decoding it from JSON if possible.
  96.   $decoded_json = json_decode( $contents );
  97.   $data['contents'] = $decoded_json ? $decoded_json : $contents;
  98.   
  99.   // Generate appropriate content-type header.
  100.   $is_xhr = strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';
  101.   header( 'Content-type: application/' . ( $is_xhr ? 'json' : 'x-javascript' ) );
  102.   
  103.   // Get JSONP callback.
  104.   $jsonp_callback = $enable_jsonp && isset($_GET['callback']) ? $_GET['callback'] : null;
  105.   
  106.   // change to utf-8
  107.   $charset = mb_detect_encoding($data['contents'],array('UTF-8','GBK','GB2312'));
  108.   $charset = strtolower($charset);
  109.   if('cp936' == $charset){
  110.       $charset='GBK';
  111.   }
  112.   if("utf-8" != $charset){
  113.       $data['contents'] = iconv($charset,"UTF-8//IGNORE",$data['contents']);
  114.   }
  115.   
  116.   // Generate JSON/JSONP string
  117.   $json = json_encode( $data );
  118.   
  119.   print $jsonp_callback ? "$jsonp_callback($json)" : $json;
  120.   
  121. }

  122. ?>
复制代码

作者: nowonder    时间: 2017-1-24 13:44
爱国者捣蛋 发表于 2016-12-30 16:24
就是glype,很久前还有个phpproxy不过很少用了
你给老人搭个反代多省事

glype中文支持很差。

如果不加密,很快就被封了。
如果加密,中文大都是乱码。




欢迎光临 全球主机交流论坛 (https://52.ht/) Powered by Discuz! X3.4