code: protected function qsencode(array $data = array()) {
          $req = '';
          
          if ($data) {
              foreach ($data as $key => $value) {
                  $req .= $key . '=' . urlencode(stripslashes($value)) . '&';
              }
              $req = substr($req, 0, strlen($req) - 1); // Cut the last '&'
          }
          
          return $req;
      }
docs: Encodes the given data into a query string format
  
  @param array $data An array of string elements to be encoded
  @return string Encoded request