To quote Ref #1:
Entity body is the term used for the body of an HTTP message. The entity body of requests and responses is inherently a PHP stream in Guzzle.
This means that the EntityBody object can be used with HTTP requests and responses.
The method signature for Client::post()
is post($uri = null, $headers = null, $postBody = null, array $options = array()).
As seen within your code snippet, you are not setting the body of the post request. Infact all you are doing is setting some uri query parameters.
Based on Ref #2, #3, and #4: you will probably want to do something like:
$body = EntityBody::factory(fopen($file_location));
$body->compress(); //compresses the body using the deflate php stream filter
$request = $client->post($uri, $headers, $body, $options);
$response = $client->send($request);
I should state that I have never actually done this, I have been using v4+ for the bulk of the last 1.5 yr and I am unable to test this out at the moment.
References:
- Entity Bodies
- Entity Bodies - Compression
- Using Request Objects - POST Requests
- Guzzle 3 - Client.php