當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Request::getContent方法代碼示例

本文整理匯總了PHP中Buzz\Message\Request::getContent方法的典型用法代碼示例。如果您正苦於以下問題:PHP Request::getContent方法的具體用法?PHP Request::getContent怎麽用?PHP Request::getContent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Buzz\Message\Request的用法示例。


在下文中一共展示了Request::getContent方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setCurlOptsFromRequest

 protected static function setCurlOptsFromRequest($curl, Message\Request $request)
 {
     curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $request->getMethod());
     curl_setopt($curl, CURLOPT_URL, $request->getUrl());
     curl_setopt($curl, CURLOPT_HTTPHEADER, $request->getHeaders());
     curl_setopt($curl, CURLOPT_POSTFIELDS, $request->getContent());
 }
開發者ID:richardmiller,項目名稱:Linktuesday.com,代碼行數:7,代碼來源:Curl.php

示例2: isSpam

 /**
  * Tells if the data looks like spam
  *
  * @param array $data
  * @return boolean
  */
 public function isSpam(array $data)
 {
     $data['blog'] = $this->blogUrl;
     $request = new Message\Request('POST', '/1.1/comment-check', $this->getHost());
     $request->setContent(http_build_query($data));
     $request->addHeader('Content-Type: application/x-www-form-urlencoded');
     $request->addHeader(sprintf('Content-Length: %d', strlen($request->getContent())));
     $response = new Message\Response();
     $client = new Client\Curl();
     $client->send($request, $response);
     return 'true' == $response->getContent();
 }
開發者ID:sblmasta,項目名稱:OrnicarAkismetBundle,代碼行數:18,代碼來源:AkismetBuzzAdapter.php

示例3: getPostFields

 /**
  * Returns a value for the CURLOPT_POSTFIELDS option.
  *
  * @return string|array A post fields value
  */
 private static function getPostFields(Message\Request $request)
 {
     if (!$request instanceof Message\FormRequest) {
         return $request->getContent();
     }
     $fields = $request->getFields();
     $multipart = false;
     foreach ($fields as $name => $value) {
         if ($value instanceof Message\FormUpload) {
             $multipart = true;
             if ($file = $value->getFile()) {
                 // replace value with upload string
                 $fields[$name] = '@' . $file;
                 if ($contentType = $value->getContentType()) {
                     $fields[$name] .= ';type=' . $contentType;
                 }
             } else {
                 return $request->getContent();
             }
         }
     }
     return $multipart ? $fields : http_build_query($fields);
 }
開發者ID:kingsj,項目名稱:core,代碼行數:28,代碼來源:Curl.php

示例4: makeContentHash

 protected function makeContentHash(Request $request)
 {
     if ('POST' == $request->getMethod()) {
         $body = $request->getContent();
         return base64_encode(hash('sha256', $body, true));
     }
     return "";
 }
開發者ID:bluestatedigital,項目名稱:akamai-api-client,代碼行數:8,代碼來源:Client.php

示例5: getStreamContextArray

 /**
  * Converts a request into an array for stream_context_create().
  * 
  * @param Message\Request $request A request object
  * 
  * @return array An array for stream_context_create()
  */
 public function getStreamContextArray(Message\Request $request)
 {
     return array('http' => array('method' => $request->getMethod(), 'header' => implode("\r\n", $request->getHeaders()), 'content' => $request->getContent(), 'protocol_version' => $request->getProtocolVersion(), 'ignore_errors' => $this->getIgnoreErrors(), 'max_redirects' => $this->getMaxRedirects(), 'timeout' => $this->getTimeout()));
 }
開發者ID:richardmiller,項目名稱:Linktuesday.com,代碼行數:11,代碼來源:AbstractStream.php


注:本文中的Buzz\Message\Request::getContent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。