From my magento site I'm trying to make a PUT request to an external API. GET and POST requests are working fine.
This is the code I'm using:
$params = 'param1/param2';
$client = new Varien_Http_Client($this->_ip . 'myMethod/' . $params);
$client->setMethod(Varien_Http_Client::PUT); // POST and GET work fine
$response = $client->request();
If I check the web server a GET request is received!!!
I've used a REST client to make the same PUT request:
PUT http://MyIP/myMethod/param1/param2
and it works fine, so the problem is not the web server that is not allowing PUT requests, but probably my Magento code, that is kind of sending GET instead of PUT. I've tried to debug and the client's method is set correctly to PUT.
I don't see what can be wrong here.
Thanks!
Amazing!
It worked using:
$params = 'param1/param2';
$client = new Zend_Http_Client($this->_ip . 'myMethod/' . $params);
$response = $client->request('PUT');
Who can explain this? What's wrong with Varien_Http_Client and PUT method?