Tag Archives: Zend

Missing `foo=bar` POST data line in Zend\Http\Request example of generating a formatted HTTP Request from a Request object

If You’re missing the foo=bar line in the output of the example Generating a formatted HTTP Request from a Request object, just add: $request->setContent($request->getPost()->toString()); right before: echo `$request->toString(); The original (not working) example (found here): use Zend\Http\Request; $request = new Request(); $request->setMethod(Request::METHOD_POST); $request->setUri(‘/foo’); $request->getHeaders()->addHeaders(array( ‘HeaderField1’ => ‘header-field-value1’, ‘HeaderField2’ => ‘header-field-value2’, )); $request->getPost()->set(‘foo’, ‘bar’); echo $request->toString(); Read the full article…

Too much content was extracted from the stream (* instead of * bytes) Zend\Http\Headers Object while trying Data Streaming with Zend\Http\Client

I was having fun with Zend\Http\Client and wanted to try Data Streaming for downloading larger files. But there was a strange problem – downloads were aborted and an exception was thrown with the message: Too much content was extracted from the stream (976 instead of 687 bytes) Zend\Http\Headers Object