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


PHP Connection::post方法代码示例

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


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

示例1: getResult

 /**
  * Execute and get the traversal result
  *
  * @return array $responseArray
  */
 public function getResult()
 {
     $bodyParams = $this->attributes;
     $response = $this->_connection->post(Urls::URL_TRAVERSAL, $this->getConnection()->json_encode_wrapper($bodyParams));
     $responseArray = $response->getJson();
     return $responseArray;
 }
开发者ID:vinigomescunha,项目名称:ArangoDB-Ajax-PHP-Example,代码行数:12,代码来源:Traversal.php

示例2: create

 /**
  * creates a database
  *
  * This creates a new database<br>
  *
  * @param Connection $connection - the connection to be used
  * @param string     $name       - the database specification, for example 'myDatabase'
  *
  * @link http://www.arangodb.com/manuals/1.4/HttpDatabase.html
  *
  * @return array $responseArray - The response array.
  */
 public static function create(Connection $connection, $name)
 {
     $payload = array(self::ENTRY_DATABASE_NAME => $name);
     $response = $connection->post(Urls::URL_DATABASE, $connection->json_encode_wrapper($payload));
     $responseArray = $response->getJson();
     return $responseArray;
 }
开发者ID:vinigomescunha,项目名称:ArangoDB-Ajax-PHP-Example,代码行数:19,代码来源:Database.php

示例3: execute

 /**
  * Execute the transaction
  *
  * This will post the query to the server and return the results as
  * a Cursor. The cursor can then be used to iterate the results.
  *
  * @throws Exception throw exception if transaction failed
  * @return mixed true if successful without a return value or the return value if one was set in the action
  */
 public function execute()
 {
     $response = $this->_connection->post(Urls::URL_TRANSACTION, $this->getConnection()->json_encode_wrapper($this->attributes));
     $responseArray = $response->getJson();
     if (isset($responseArray['result'])) {
         return $responseArray['result'];
     }
     return true;
 }
开发者ID:vinigomescunha,项目名称:ArangoDB-Ajax-PHP-Example,代码行数:18,代码来源:Transaction.php

示例4: register

 /**
  * Registers the user function
  *
  * If no parameters ($name,$code) are passed, it will use the properties of the object.
  *
  * If $name and/or $code are passed, it will override the object's properties with the passed ones
  *
  * @param null $name
  * @param null $code
  *
  * @throws Exception throws exception if registration failed
  *
  * @return mixed true if registration was successful.
  */
 public function register($name = null, $code = null)
 {
     $attributes = $this->attributes;
     if ($name) {
         $attributes['name'] = $name;
     }
     if ($code) {
         $attributes['code'] = $code;
     }
     $response = $this->_connection->post(Urls::URL_AQL_USER_FUNCTION, $this->getConnection()->json_encode_wrapper($attributes));
     $responseArray = $response->getJson();
     return $responseArray;
 }
开发者ID:vinigomescunha,项目名称:ArangoDB-Ajax-PHP-Example,代码行数:27,代码来源:AqlUserFunction.php

示例5: execute

 /**
  * Execute the export
  *
  * This will return the results as a Cursor. The cursor can then be used to iterate the results.
  *
  * @throws Exception
  * @return ExportCursor
  */
 public function execute()
 {
     $data = array(self::ENTRY_FLUSH => $this->_flush, self::ENTRY_COUNT => true);
     if ($this->_batchSize > 0) {
         $data[self::ENTRY_BATCHSIZE] = $this->_batchSize;
     }
     if ($this->_limit > 0) {
         $data[self::ENTRY_LIMIT] = $this->_limit;
     }
     if (is_array($this->_restrictions)) {
         $data[self::ENTRY_RESTRICT] = $this->_restrictions;
     }
     $collection = $this->_collection;
     if ($collection instanceof Collection) {
         $collection = $collection->getName();
     }
     $url = UrlHelper::appendParamsUrl(Urls::URL_EXPORT, array("collection" => $collection));
     $response = $this->_connection->post($url, $this->getConnection()->json_encode_wrapper($data));
     return new ExportCursor($this->_connection, $response->getJson(), $this->getCursorOptions());
 }
开发者ID:vinigomescunha,项目名称:ArangoDB-Ajax-PHP-Example,代码行数:28,代码来源:Export.php

示例6: process

 /**
  * Processes this batch. This sends the captured requests to the server as one batch.
  *
  * @throws ClientException
  * @return bool - true if processing of the batch was  or the HttpResponse object in case of a failure. A successful process just means that tha parts were processed. Each part has it's own response though and should be checked on its own.
  */
 public function process()
 {
     $this->stopCapture();
     $this->setBatchRequest(true);
     $data = '';
     $batchParts = $this->getBatchParts();
     if (count($batchParts) == 0) {
         throw new ClientException('Can\'t process empty batch.');
     }
     /** @var $partValue BatchPart */
     foreach ($batchParts as $partValue) {
         $data .= '--' . HttpHelper::MIME_BOUNDARY . HttpHelper::EOL;
         $data .= 'Content-Type: application/x-arango-batchpart' . HttpHelper::EOL;
         if (!is_null($partValue->getId())) {
             $data .= 'Content-Id: ' . (string) $partValue->getId() . HttpHelper::EOL . HttpHelper::EOL;
         } else {
             $data .= HttpHelper::EOL;
         }
         $data .= (string) $partValue->getRequest() . HttpHelper::EOL;
     }
     $data .= '--' . HttpHelper::MIME_BOUNDARY . '--' . HttpHelper::EOL . HttpHelper::EOL;
     $params = array();
     $url = UrlHelper::appendParamsUrl(Urls::URL_BATCH, $params);
     $this->_batchResponse = $this->_connection->post($url, $data);
     if ($this->_batchResponse->getHttpCode() !== 200) {
         return $this->_batchResponse;
     }
     $body = $this->_batchResponse->getBody();
     $body = trim($body, '--' . HttpHelper::MIME_BOUNDARY . '--');
     $batchParts = $this->splitWithContentIdKey('--' . HttpHelper::MIME_BOUNDARY . HttpHelper::EOL, $body);
     foreach ($batchParts as $partKey => $partValue) {
         $response = new HttpResponse($partValue);
         $body = $response->getBody();
         $response = new HttpResponse($body);
         $batchPartResponses[$partKey] = $response;
         $this->getPart($partKey)->setResponse($batchPartResponses[$partKey]);
     }
     return $this;
 }
开发者ID:vinigomescunha,项目名称:ArangoDB-Ajax-PHP-Example,代码行数:45,代码来源:Batch.php

示例7: modify

 /**
  * modifies an endpoint
  *
  * This will modify an existing or create a new endpoint.
  *
  * @param Connection $connection - the connection to be used
  * @param string     $endpoint   - the endpoint specification, e.g. tcp://127.0.0.1:8530
  * @param array      $databases  - a list of database names the endpoint is responsible for.
  *
  * @link http://www.arangodb.com/manuals/1.4/HttpEndpoint.html
  * @return array $responseArray - The response array.
  */
 public static function modify(Connection $connection, $endpoint, array $databases)
 {
     $payload = array(self::ENTRY_ENDPOINT => $endpoint, self::ENTRY_DATABASES => $databases);
     $response = $connection->post(Urls::URL_ENDPOINT, $connection->json_encode_wrapper($payload));
     $responseArray = $response->getJson();
     return $responseArray;
 }
开发者ID:TomSearch,项目名称:arangodb-php-docs,代码行数:19,代码来源:Endpoint.php

示例8: validate

 /**
  * Validates the statement
  *
  * This will post the query to the server for validation and return the validation result as an array.
  *
  * @throws Exception
  * @return Array
  */
 public function validate()
 {
     $data = $this->buildData();
     $response = $this->_connection->post(Urls::URL_QUERY, $this->getConnection()->json_encode_wrapper($data));
     return $response->getJson();
 }
开发者ID:vinigomescunha,项目名称:ArangoDB-Ajax-PHP-Example,代码行数:14,代码来源:Statement.php


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