Create request
Use HTTP POST to send data
@param string|Gnkw\Http\Uri $service Service to call
@param string|array $headers Request headers
@param string $data Data to create
@see post
@return Gnkw\Http\Rest\Resource
353348
public function create($service, $headers = null, $data = null)
	{
		return $this->post($service, $headers, $data);
	}
538231
public function post($url, $data = '', array $headers = [])
    {
        return $this->executor->execute(
            $url,
            [
                CURLOPT_POST => true,
                CURLOPT_HTTPHEADER => $headers,
                CURLOPT_POSTFIELDS => $data,
            ]
        );
    }
382891
public static function json($data = array(), $status = 200, array $headers = array())
	{
		if ($data instanceof ArrayableInterface)
		{
			$data = $data->toArray();
		}

		return new JsonResponse($data, $status, $headers);
	}
996277
public function sendData($data)
    {
        $httpResponse = $this->httpClient->post($this->getEndpoint(), null, $data)->send();

        return $this->response = new Response($this, $httpResponse->getBody());
    }
31554
public function postRequest($uri, array $data = null)
    {
        return $this->getClient()->post($uri, [
            'json' => $this->createBody($data)
        ]);
    }
567020
public function put($service, $headers = [], $body = '', $form_params = [])
    {
        return $this->callRestService('PUT', $service, $headers, $body, $form_params);
    }
119947
public function read($service, $headers = null, $data = null)
	{
		return $this->get($service, $headers, $data);
	}
409334
public function createSubscription(array $data, array $headers = [])
    {
        $url = $this->url('estimates/create_subscription');

        return $this->post($url, $data, $headers);
    }
311378
public function post($uri, array $headers = [], $datas = [], array $files = [])
    {
        return $this->send($uri, InternalRequestInterface::METHOD_POST, $headers, $datas, $files);
    }
860650
public function put($service, $headers = null, $data = null)
	{
		return $this->customRequest($service, 'PUT', $headers, $data);
	}
763214
public function get($service, $headers = null, $data = null)
	{
		return $this->customRequest($service, 'GET', $headers, $data);
	}
919012
protected function respondWithSuccess($data, TransformerAbstract $transformer = null, array $headers = [])
    {
        if ($transformer) {
            return $this->respondTransformer($data, SymfonyResponse::HTTP_OK, $transformer, $headers);
        }
        return $this->respondWithSimpleSuccess($data);
    }
999080
public function put($uri, array $headers = [], $datas = [], array $files = [])
    {
        return $this->send($uri, InternalRequestInterface::METHOD_PUT, $headers, $datas, $files);
    }
1289594
protected function buildRequest($method, $url, $data, $headers)
    {
        $parts = parse_url($url);
        $host  = $parts['host'];
        $path  = $parts['path'];

        // Create basic request headers
        $request = "$method $path HTTP/1.1\r\nHost: {$host}\r\n";

        // Set keep-alive header, which helps to keep to connection
        // initilization costs low, especially when the database server is not
        // available in the locale net.
        $request .= 'Connection: ' . ($this->options['keep-alive'] ? 'Keep-Alive' : 'Close') . "\r\n";

        // Also add headers and request body if data should be sent to the
        // server. Otherwise just add the closing mark for the header section
        // of the request.
        foreach ($headers as $name => $header) {
            $request .= $name . ': ' . $header . "\r\n";
        }
        $request = rtrim($request) . "\r\n\r\n";

        if ($data !== null) {
            $request .= $data;
        }

        return $request;
    }
960728
public function create($data, $webhookId = null)
    {
        if (isset($webhookId)) {
            return $this->client()->put($data, 'webhooks/{webhookId}', ['webhookId' => $webhookId]);
        }

        return $this->client()->post($data, 'webhooks');
    }
969655
public function post($url, $data, $headers = [])
    {
        $request = new Request('POST', $url, $headers);
        $response = $this->apiClient->send(
            $request,
            [
                'form_params' => $data,
            ]
        );
        $result = json_decode($response->getBody(), true);
        return $result;
    }
1230615
public static function resourceJson($data = array(), $status = 200, array $headers = array())
  {
    $resource = new Resource($data);
    $etag = $resource->getEtag();

    if ( ! empty($etag)) {
      $headers['ETag'] = $etag;
    }

    unset($resource);

    return self::json($data, $status, $headers);
  }