当前位置: 首页>>代码示例>>PHP>>正文


PHP unknown::getBody方法代码示例

本文整理汇总了PHP中unknown::getBody方法的典型用法代码示例。如果您正苦于以下问题:PHP unknown::getBody方法的具体用法?PHP unknown::getBody怎么用?PHP unknown::getBody使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在unknown的用法示例。


在下文中一共展示了unknown::getBody方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: outputResponse

 /**
  * Prints the response from SmartCloud or IBM Connections on Premise.
  *
  * @param unknown $response
  */
 public function outputResponse($response, $url)
 {
     $store = SBTCredentialStore::getInstance();
     if ($response->getStatusCode() == 200) {
         if (isset($_REQUEST["isAuthenticated"]) && $settings->getAuthenticationMethod() == "basic") {
             $result = array('status' => $response->getStatusCode(), 'result' => $response->getStatusCode() == 401 ? false : true);
             print_r(json_encode($result));
         } else {
             foreach ($response->getHeaderLines() as $h) {
                 if (strpos($h, "Content-Type") === 0) {
                     header($h, TRUE);
                 }
             }
             header(':', true, $response->getStatusCode());
             header('X-PHP-Response-Code: ' . $response->getStatusCode(), true, $response->getStatusCode());
             if (isset($_REQUEST['actionType']) && $_REQUEST['actionType'] == 'download' || strpos($url, '/media/') != false && strpos($url, '/document/') != false) {
                 $headers = $response->getHeaders();
                 header('Content-Description: File Transfer');
                 header('Content-Type: application/octet-stream');
                 header('Content-Disposition: ' . $headers['content-disposition']);
                 header('Content-Transfer-Encoding: binary');
                 //changed to chunked
                 header('Expires: 0');
                 header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
                 header('Pragma: public');
             }
             print_r($response->getBody(TRUE));
         }
     } else {
         if ($response->getStatusCode() == 302) {
             $headers = $response->getHeaders();
             $this->route($headers['location']);
         } else {
             if ($response->getStatusCode() == 201) {
                 $result = array('status' => 201, 'result' => true);
                 print_r(json_encode($result));
             } else {
                 if ($response->getStatusCode() == 400) {
                     echo "400 - Bad Request";
                     print_r($response->getBody(TRUE));
                 } else {
                     if ($response->getStatusCode() == 401 || $response->getStatusCode() == '401oauth_token_expired') {
                         if (isset($_GET['endpointName'])) {
                             $store->deleteOAuthCredentials($_GET['endpointName']);
                             $store->deleteBasicAuthCredentials($_GET['endpointName']);
                         } else {
                             $store->deleteOAuthCredentials();
                             $store->deleteBasicAuthCredentials();
                         }
                         print_r($response->getStatusCode());
                     } else {
                         print_r($response->getBody(TRUE));
                     }
                 }
             }
         }
     }
 }
开发者ID:ItemConsulting,项目名称:SocialSDK,代码行数:63,代码来源:SBTProxyHelper.php

示例2: parseBinaryFrame

 /**
  * Parse binary frame.
  * 
  * @param unknown $frame
  * @return stdClass | array | 
  */
 public function parseBinaryFrame($frame)
 {
     $data = NULL;
     $frameBody = NULL;
     $traceId = NULL;
     // check frame flags
     $flagStatus = $this->_checkFrameFlags($frame->getFlag());
     // do we need to decompress
     // @TODO need to add check to see which compression has been used, can't assume snappy
     // all the time...
     if ($flagStatus->compression) {
         $frameBody = snappy_uncompress($frame->getBody());
     } else {
         $frameBody = $frame->getBody();
     }
     // do we need to grab a tracing id
     if ($flagStatus->tracing) {
         $traceId = $this->parseUuid($frameBody);
     }
     switch ($frame->getOpcode()) {
         case \McFrazier\PhpBinaryCql\CqlConstants::FRAME_OPCODE_ERROR:
             $data = $this->parseError($frameBody);
             break;
         case \McFrazier\PhpBinaryCql\CqlConstants::FRAME_OPCODE_SUPPORTED:
             $data = $this->parseStringMultimap($frameBody);
             break;
         case \McFrazier\PhpBinaryCql\CqlConstants::FRAME_OPCODE_RESULT:
             $data = $this->parseResult($frameBody);
             break;
         case \McFrazier\PhpBinaryCql\CqlConstants::FRAME_OPCODE_AUTHENTICATE:
             $data = $this->parseString($frameBody);
             break;
     }
     // add the tracing id... if present
     if ($traceId) {
         $data->traceId = $traceId;
     }
     return $data;
 }
开发者ID:karthik1301,项目名称:phpbinarycql,代码行数:45,代码来源:CqlProtocol.php


注:本文中的unknown::getBody方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。