Example #1
0
 /**
  * Convert the request parameters into a query string, suitable for GET and
  * POST requests.
  *
  *     $query = $request->as_query();
  *
  * [!!] This method implements [OAuth 1.0 Spec 5.2 (2,3)](http://oauth.net/core/1.0/#rfc.section.5.2).
  *
  * @param   boolean   include oauth parameters?
  * @param   boolean   return a normalized string?
  * @return  string
  */
 public function as_query($include_oauth = NULL, $as_string = TRUE)
 {
     if ($include_oauth === NULL) {
         // If we are sending a header, OAuth parameters should not be
         // included in the query string.
         $include_oauth = !$this->send_header;
     }
     if ($include_oauth) {
         $params = $this->params;
     } else {
         $params = array();
         foreach ($this->params as $name => $value) {
             if (strpos($name, 'oauth_') !== 0) {
                 // This is not an OAuth parameter
                 $params[$name] = $value;
             }
         }
     }
     return $as_string ? OAuth1::normalize_params($params) : $params;
 }