I use $site->setParameterPost
and $site->request('POST')->getBody()
for posting data to an action, one parameter of setParameterPost
is very big data, and it doesn't send data via post method. What can I do?
$config = array('adapter' => 'Zend_Http_Client_Adapter_Curl' );
$site = new Zend_Http_Client('http://somewhere.tld/api/news', $config);
$site->setParameterPost(array(
'news' => $news, //very big data, without it data send properly
'modelName' => 'somemodel',
'method' => 'somemethod',
'key' => 'something',
'siteName' => $sitename,
));
$sitedata = $site->request('POST')->getBody();
I should use streaming requests, which are allowed only with PUT method.
$http_client = new Zend_Http_Client ('http://something.some/thing');
$http_client->setConfig (array (
'adapter' => 'Zend_Http_Client_Adapter_Curl',
'timeout' => 180
));
$file = fopen ('news.dat', 'r'); // put all your news to the file beforehand
$http_client->setRawData ($file);
$http_client->setParameterPost (array (
'modelName' => 'somemodel',
'method' => 'somemethod',
'key' => 'something',
'siteName' => $sitename
));
$response = $http_client->request ('PUT');
On the server-side you can access your big data through
fopen ("php://input", "r");