コード例 #1
0
 public static function challenge($problem, $advice, $realm = 'Users')
 {
     $challenge = 'OAuth realm="' . $realm . '"';
     if (!empty($problem)) {
         $challenge .= ', oauth_problem="' . Rfc3986::urlEncode($problem) . '"';
     }
     if (!empty($advice)) {
         $challenge .= ', oauth_problem_advice="' . Rfc3986::urlEncode($advice) . '"';
     }
     return $challenge;
 }
コード例 #2
0
 /**
  * Get the body of a POST with multipart/form-data by Edison tsai on 16:52 2010/09/16
  * Used for fetching the post parameters and to calculate the body signature.
  *
  * @return string null when no body present (or wrong content type for body)
  */
 protected function getRequestBodyOfMultipart()
 {
     $body = null;
     if ($this->method == 'POST') {
         $body = '';
         if (is_array($_POST) && count($_POST) > 1) {
             foreach ($_POST as $k => $v) {
                 $body .= $k . '=' . Rfc3986::urlEncode($v) . '&';
             }
             if (substr($body, -1) == '&') {
                 $body = substr($body, 0, strlen($body) - 1);
             }
         }
     }
     return $body;
 }