I'm testing the restful service built with zend framework. I'm using the command below to test it (learned from this post).
curl -v -H "Content-Type: application/json" -X GET -d '{"locationId":"33","limit":"5开发者_开发问答","offset":"0"}' \ http://localhost/api/review
But when I fetch the request body in Zend using $payload = $this->getRequest()->getRawBody();
, the var_dump($payload) returns "'{locationId:33,limit:5,offset:0}'"
, where the double quotation marks are removed so that I can't decode it into array.
What's reason of it? Please help. Thank s in advance.
The Windows command line is removing the double quotes. It also does not recognize single quotes. You can try double quoting the entire thing and escaping the quotes use internally like this:
curl -v -H "Content-Type: application/json" -X GET -d "{\"locationId\":\"33\",\"limit\":\"5\",\"offset\":\"0\"}" http://localhost/api/review
精彩评论