Am trying to update my record via the PUT method
$client = new Zend_Http_Client();
$client->setMethod(Zend_Http_Client::PUT);
$开发者_运维百科client->setUri('http://example.com/api/type/');
$client->setParameterPost(array(
'useremail' => '*****@****.***',
'apikey' => 'secretkey',
'expenseid' => '4',
'description' => 'TEST WEB API',
'amount' => '5000.00',
));
However it does not seem to work.The same also applies to Zend_Http_Client::DELETE. It seems only Zend_Http_Client::POST and Zend_Http_Client::GET are working.
What am I missing?
I'm not familiar with Zend Framework's implementation yet, but you may want to check that you have Apache configured to allow PUT and DELETE requests.
Assuming that you are using virtual hosts and userdirs, see the following file:
.../apache/conf/extra/httpd-userdir.conf
In that file make sure that you have PUT
and DELETE
in the list of allowed HTTP methods for your directory.
<Directory ".../path-to-your-vhost-directory-here">
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit HEAD GET POST PUT DELETE OPTIONS>
Order deny,allow
Deny from all
Allow from localhost
</Limit>
<LimitExcept HEAD GET POST PUT DELETE OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
Edit:
you can find the official documentation for the directive here:
http://httpd.apache.org/docs/current/mod/core.html#limit
精彩评论