/** * Push Request * * Execute push request * * @param string $url - url of the to send the request. * @param Array $data - Array to data to send if not null. * @param string $type - Type of data specified in request. * @param Array $option - Array of options to add into request as get variables. * @param Array $header - Array of header to add into request as http headers. * @param boolean $entityAdmin - flag to use either _api or _admin in request. * * * @return array $response - The response array. */ public function push($url, $data = NULL, $type = NULL, $option = NULL, $headers = NULL, $entityAdmin = false) { $entity = self::ENTRY_API; if ($entityAdmin) { $entity = self::ENTRY_ADMIN; } $uri = $this->protocol . '://' . $this->user . ':' . $this->pass . '@' . $this->host . ':' . $this->port . '/' . self::ENTRY_DB . '/' . $this->db . '/' . $entity . '/' . $url; if ($option != NULL) { $uri .= '?'; foreach ($option as $key => $value) { # code... $uri .= $key . '=' . $value . '&'; } } $http = new Client(); $response = $http->push($uri, json_encode($data), ['type' => 'json'], ['headers' => $headers]); return $response; }