Reputation: 7805
The Zend_Http_Client docs are confusing and hard to understand. Currently I am using the following code to GET information from the Challonge API:
$client = new Zend_Http_Client("https://api.challonge.com/v1/tournaments/$bracket.json");
$client->setParameterGet(array(
'api_key' => $apikey,
'include_participants' => 1,
));
$feed = $client->request()->getBody();
Very simple, three lines. Now this is a GET. How would I do the same exact thing as a PUT? Passing parameters and everything. What about a DELETE?
Upvotes: 0
Views: 1564
Reputation: 920
Sorry, I know this is not directly related to the question Json Axelrod asked, but I had a similar problem and could not find the solution anywhere online.
I was trying to do a PUT / DELETE request with Magentos Varien_Http_Client
class Varien_Http_Client extends Zend_Http_Client
So I thought the same would apply that was written in this topic and here. However no matter what I tried I could not get PUT nor DELETE requests to work.
Really simple solution in that case: Use Zend_Http_Client instead of Varien_Http_Client. It seems that Magentos Http Client class is adding some extra "convenient" methods for preparing the body that won't allow PUT nor DELETE requests.
Upvotes: 3
Reputation: 8021
You would do
$client->request('POST')
or
$client->request('DELETE')
Upvotes: 0