Zend_Http_Client :: PUT not working

I am trying to update my record using 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, this does not work. The same applies to Zend_Http_Client :: DELETE . Only Zend_Http_Client :: POST and Zend_Http_Client :: GET seem to work .

What am I missing?

+3
source share
1 answer

I am not familiar with the Zend Framework implementation yet, but you can verify that you have Apache configured to allow PUT and DELETE requests.

Assuming you are using virtual hosts and userdirs, see the following file:
.../apache/conf/extra/httpd-userdir.conf

, PUT DELETE HTTP- .

<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: :
http://httpd.apache.org/docs/current/mod/core.html#limit

+1

Source: https://habr.com/ru/post/1756994/


All Articles