Reputation: 121
I'm trying to use the PUT method with the Zend Http Client but I'm unable to add parameters to the request.
Here's my code snippet:
$client = new Zend_Http_Client($this->url);
$client->setAuth($this->username, $this->password, Zend_Http_Client::AUTH_BASIC);
$client->setParameterPut('fruit',$var);
$result = $client->request('PUT');
$data = $result->getBody();
I have already declared "url", "username", "password" and "var" previously in the code.
Upvotes: 1
Views: 988
Reputation: 3673
While you didn't include the error, there is no such method in Zend_Http_Client as $client->setParameterPut()
.
PUT requests do not have "parameter" semantics. To send content in a PUT request, you most likely want to use $client->setRawData($data, $enctype)
where $data
is your data, that is parameters encoded in some form, and $enctype
is the Content-type, which is optional but recommended or required by most APIs.
Upvotes: 1