public function post($url, $data, $contentType = 'application/json')
    {
        $uri = $this->buildUrl($url);

        $request = $this->requestFactory->createRequest('POST', $uri);
        if (!is_null($contentType)) {
            $request = $request->withHeader('Content-Type', $contentType);
            $request = $request->withHeader('Accept', $contentType);
        }
        $request = $request->withBody(stream_for($data));

        $response = $this->request($request);

        return strval($response->getBody());
    }
public function post($url, $data, $contentType = 'application/json')
    {
        $uri = $this->buildUrl($url);

        $request = $this->requestFactory->createRequest('POST', $uri);
        if (!is_null($contentType)) {
            $request = $request->withHeader('Content-Type', $contentType);
            $request = $request->withHeader('Accept', $contentType);
        }
        $request = $request->withBody(stream_for($data));

        $response = $this->request($request);

        return strval($response->getBody());
    }
public function post ( $ url , $ data , $ contentType = 'application/json' ) { $ uri = $ this -> buildUrl ( $ url ) ; $ request = $ this -> requestFactory -> createRequest ( 'POST' , $ uri ) ; if ( ! is_null ( $ contentType ) ) { $ request = $ request -> withHeader ( 'Content-Type' , $ contentType ) ; $ request = $ request -> withHeader ( 'Accept' , $ contentType ) ; } $ request = $ request -> withBody ( stream_for ( $ data ) ) ; $ response = $ this -> request ( $ request ) ; return strval ( $ response -> getBody ( ) ) ; }
Make a POST request.

@param string $url
@param $data
@param string $contentType

@return string The response body
Make a POST request .