original_string: public function get() {
          
          if (!isset($this->request->args[0])) {
              exit;
          }
  
          $url = $this->request->args[0];
  
          //add the $_GET vars to the request
          $query_string = http_build_query($this->request->get);
          $destination_url = $url . ($query_string ? '?'.$query_string : '');
  
          //exit if onBeforeGet doesn't pass
          if($this->onBeforeGet($destination_url) === false){
              return false;
          }
          
          //logs to file if enabled
          if($this->log_to_file){
              $logger = new \sb\Logger\CommandLine();
              $log_name = preg_replace("~[^\w+]~", "_", get_called_class());
              $logger->{$log_name}(json_encode(["ip" => \sb\Gateway::$remote_addr, "url" => $destination_url, "get" => $query_string, "post" => $this->request->post]));    
          }
          
          //proxy to site and return response
          $ch = curl_init();
          
          //set the url to grab the data from
          curl_setopt($ch, CURLOPT_URL, $destination_url);
          
          //set the function to pass the headers from the destination back to the client
          curl_setopt($ch, CURLOPT_HEADERFUNCTION, array($this, 'headerCallBack'));
          
          //set the agent to be used for request
          curl_setopt($ch, CURLOPT_USERAGENT, $this->agent);
          
          //wait 10 seconds for timeout
          curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
          curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->timeout);
          
          //forward any post requests if they exist
          if(count($this->request->post)){
              curl_setopt($ch, CURLOPT_POST, true);
              curl_setopt($ch, CURLOPT_POSTFIELDS, $this->request->post);
          }
          
          //follow any redirects
          curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
          
          //return the result
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
          
          //ignore ssl errors if set to true
          if($this->ignore_ssl_errors){
              curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
              curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
          }
          
          //set any additional curl_opts given
          foreach($this->curl_opts as $key=>$val){
              curl_setopt($ch, $key, $val);
          }
          
          //display the output
          return curl_exec($ch);
      }
code: public function get() {
          
          if (!isset($this->request->args[0])) {
              exit;
          }
  
          $url = $this->request->args[0];
  
          //add the $_GET vars to the request
          $query_string = http_build_query($this->request->get);
          $destination_url = $url . ($query_string ? '?'.$query_string : '');
  
          //exit if onBeforeGet doesn't pass
          if($this->onBeforeGet($destination_url) === false){
              return false;
          }
          
          //logs to file if enabled
          if($this->log_to_file){
              $logger = new \sb\Logger\CommandLine();
              $log_name = preg_replace("~[^\w+]~", "_", get_called_class());
              $logger->{$log_name}(json_encode(["ip" => \sb\Gateway::$remote_addr, "url" => $destination_url, "get" => $query_string, "post" => $this->request->post]));    
          }
          
          //proxy to site and return response
          $ch = curl_init();
          
          //set the url to grab the data from
          curl_setopt($ch, CURLOPT_URL, $destination_url);
          
          //set the function to pass the headers from the destination back to the client
          curl_setopt($ch, CURLOPT_HEADERFUNCTION, array($this, 'headerCallBack'));
          
          //set the agent to be used for request
          curl_setopt($ch, CURLOPT_USERAGENT, $this->agent);
          
          //wait 10 seconds for timeout
          curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
          curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->timeout);
          
          //forward any post requests if they exist
          if(count($this->request->post)){
              curl_setopt($ch, CURLOPT_POST, true);
              curl_setopt($ch, CURLOPT_POSTFIELDS, $this->request->post);
          }
          
          //follow any redirects
          curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
          
          //return the result
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
          
          //ignore ssl errors if set to true
          if($this->ignore_ssl_errors){
              curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
              curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
          }
          
          //set any additional curl_opts given
          foreach($this->curl_opts as $key=>$val){
              curl_setopt($ch, $key, $val);
          }
          
          //display the output
          return curl_exec($ch);
      }
code_tokens: public function get ( ) { if ( ! isset ( $ this -> request -> args [ 0 ] ) ) { exit ; } $ url = $ this -> request -> args [ 0 ] ; //add the $_GET vars to the request $ query_string = http_build_query ( $ this -> request -> get ) ; $ destination_url = $ url . ( $ query_string ? '?' . $ query_string : '' ) ; //exit if onBeforeGet doesn't pass if ( $ this -> onBeforeGet ( $ destination_url ) === false ) { return false ; } //logs to file if enabled if ( $ this -> log_to_file ) { $ logger = new \ sb \ Logger \ CommandLine ( ) ; $ log_name = preg_replace ( "~[^\w+]~" , "_" , get_called_class ( ) ) ; $ logger -> { $ log_name } ( json_encode ( [ "ip" => \ sb \ Gateway :: $ remote_addr , "url" => $ destination_url , "get" => $ query_string , "post" => $ this -> request -> post ] ) ) ; } //proxy to site and return response $ ch = curl_init ( ) ; //set the url to grab the data from curl_setopt ( $ ch , CURLOPT_URL , $ destination_url ) ; //set the function to pass the headers from the destination back to the client curl_setopt ( $ ch , CURLOPT_HEADERFUNCTION , array ( $ this , 'headerCallBack' ) ) ; //set the agent to be used for request curl_setopt ( $ ch , CURLOPT_USERAGENT , $ this -> agent ) ; //wait 10 seconds for timeout curl_setopt ( $ ch , CURLOPT_TIMEOUT , $ this -> timeout ) ; curl_setopt ( $ ch , CURLOPT_CONNECTTIMEOUT , $ this -> timeout ) ; //forward any post requests if they exist if ( count ( $ this -> request -> post ) ) { curl_setopt ( $ ch , CURLOPT_POST , true ) ; curl_setopt ( $ ch , CURLOPT_POSTFIELDS , $ this -> request -> post ) ; } //follow any redirects curl_setopt ( $ ch , CURLOPT_FOLLOWLOCATION , 1 ) ; //return the result curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , 1 ) ; //ignore ssl errors if set to true if ( $ this -> ignore_ssl_errors ) { curl_setopt ( $ ch , CURLOPT_SSL_VERIFYHOST , false ) ; curl_setopt ( $ ch , CURLOPT_SSL_VERIFYPEER , false ) ; } //set any additional curl_opts given foreach ( $ this -> curl_opts as $ key => $ val ) { curl_setopt ( $ ch , $ key , $ val ) ; } //display the output return curl_exec ( $ ch ) ; }
docstring: proxies request and responds
  
  It will proxy both GET and POST data and return respose
  
  @servable true
  
  e.g. SITE_URL/proxy/get/http://someothersite?test=rest&ff=gg
docstring_tokens: proxies request and responds