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


PHP RequestInterface::setPostField方法代碼示例

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


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

示例1: addParameter

 /**
  * Add a parameter key and value to the request according to type
  *
  * @param RequestInterface $request The request
  * @param string           $key     The name of the parameter
  * @param string           $value   The value of the parameter
  */
 public function addParameter(RequestInterface $request, $key, $value)
 {
     if ($request->getMethod() == 'POST') {
         $request->setPostField($key, $value);
     } else {
         $request->getQuery()->set($key, $value);
     }
 }
開發者ID:noahkim,項目名稱:kowop,代碼行數:15,代碼來源:SignatureV2.php

示例2: __construct

 public function __construct(ConnectionInterface $conn, RequestInterface $req)
 {
     $body = (string) $req->getBody();
     if (!empty($body)) {
         $query = QueryString::fromString($body);
         $fields = $query->getAll();
         foreach ($fields as $field => $value) {
             $req->setPostField($field, $value);
         }
     }
     $this->conn = $conn;
     $this->session = $conn->Session;
     $this->req = $req;
 }
開發者ID:Rudi9719,項目名稱:stein-syn,代碼行數:14,代碼來源:HTTPServerRequest.class.php

示例3: visit

 public function visit(CommandInterface $command, RequestInterface $request, Parameter $param, $value)
 {
     $request->setPostField($param->getWireName(), $this->prepareValue($value, $param));
 }
開發者ID:Trideon,項目名稱:gigolo,代碼行數:4,代碼來源:PostFieldVisitor.php

示例4: sendTradeAPIRequest

 /**
  * @param RequestInterface $request
  * @param int              $retryNo
  *
  * @return mixed
  * @throws RemoteError
  */
 protected function sendTradeAPIRequest(RequestInterface $request, $retryNo = 0)
 {
     if ($request instanceof EntityEnclosingRequest) {
         $nonce = (int) bcmul(bcadd(time(), substr(microtime(), 0, 3), 1), 10) - 13000000000.0;
         $request->setPostField('nonce', $nonce);
         $request->setHeader('Sign', hash_hmac('sha512', $request->getPostFields(), $this->apiSecret));
         $request->setHeader('Key', $this->apiKey);
     }
     $response = $this->send($request);
     $data = $request->getResponse()->json();
     if ($response->isSuccessful() && isset($data['success']) && 1 === $data['success']) {
         return $data['return'];
     } elseif ($response->isServerError() && $retryNo <= self::RETRY_COUNT) {
         sleep(self::RETRY_INTERVAL);
         return $this->sendTradeAPIRequest($request, ++$retryNo);
     } else {
         throw new RemoteError(isset($data['error']) ? $data['error'] : null);
     }
 }
開發者ID:alsma,項目名稱:btce-connector,代碼行數:26,代碼來源:Client.php

示例5: visit

 /**
  * {@inheritdoc}
  */
 public function visit(CommandInterface $command, RequestInterface $request, $key, $value)
 {
     $request->setPostField($key, $value);
 }
開發者ID:jsnshrmn,項目名稱:Suma,代碼行數:7,代碼來源:PostFieldVisitor.php


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