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


PHP FacebookRequest::getMethod方法代碼示例

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


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

示例1: requestEntityToBatchArray

 /**
  * Converts a Request entity into an array that is batch-friendly.
  *
  * @param FacebookRequest $request       The request entity to convert.
  * @param string|null     $requestName   The name of the request.
  * @param string|null     $attachedFiles Names of files associated with the request.
  *
  * @return array
  */
 public function requestEntityToBatchArray(FacebookRequest $request, $requestName = null, $attachedFiles = null)
 {
     $compiledHeaders = [];
     $headers = $request->getHeaders();
     foreach ($headers as $name => $value) {
         $compiledHeaders[] = $name . ': ' . $value;
     }
     $batch = ['headers' => $compiledHeaders, 'method' => $request->getMethod(), 'relative_url' => $request->getUrl()];
     // Since file uploads are moved to the root request of a batch request,
     // the child requests will always be URL-encoded.
     $body = $request->getUrlEncodedBody()->getBody();
     if ($body) {
         $batch['body'] = $body;
     }
     if (isset($requestName)) {
         $batch['name'] = $requestName;
     }
     if (isset($attachedFiles)) {
         $batch['attached_files'] = $attachedFiles;
     }
     // @TODO Add support for "omit_response_on_success"
     // @TODO Add support for "depends_on"
     // @TODO Add support for JSONP with "callback"
     return $batch;
 }
開發者ID:vihoangson,項目名稱:Family,代碼行數:34,代碼來源:FacebookBatchRequest.php

示例2: prepareRequestMessage

 /**
  * Prepares the request for sending to the client handler.
  *
  * @param FacebookRequest $request
  *
  * @return array
  */
 public function prepareRequestMessage(FacebookRequest $request)
 {
     $postToVideoUrl = $request->containsVideoUploads();
     $url = $this->getBaseGraphUrl($postToVideoUrl) . $request->getUrl();
     // If we're sending files they should be sent as multipart/form-data
     if ($request->containsFileUploads()) {
         $requestBody = $request->getMultipartBody();
         $request->setHeaders(['Content-Type' => 'multipart/form-data; boundary=' . $requestBody->getBoundary()]);
     } else {
         $requestBody = $request->getUrlEncodedBody();
         $request->setHeaders(['Content-Type' => 'application/x-www-form-urlencoded']);
     }
     return [$url, $request->getMethod(), $request->getHeaders(), $requestBody->getBody()];
 }
開發者ID:stevenyeahhh,項目名稱:distrapp,代碼行數:21,代碼來源:FacebookClient.php


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