как вызвать restful zend controller usin curl в php?

<?php require_once 'Zend/Session/Namespace.php'; class ApiController extends Zend_Rest_Controller { public function init() { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); } public function indexAction() { $query=$this->getRequest()->getParam('query'); $this->getResponse() ->appendBody("hi"); $this->getResponse()->setHttpResponseCode(200); } public function getAction() { $query=$this->getRequest()->getParam('id'); $this->getResponse() ->appendBody($query); } public function postAction() { $this->getResponse() ->setHttpResponseCode(200) ->appendBody("From postAction() creating the requested article"); } public function putAction() { $this->getResponse() ->appendBody("From putAction() updating the requested article"); } public function deleteAction() { $this->getResponse() ->appendBody("From deleteAction() deleting the requested article"); } } 

Выше мой API REST, я пытаюсь вызвать его из php curl, но я не знаю, как вызвать метод post. Я также сделал запись в bootsrap для модуля по умолчанию \ используя маршрут отдыха.

Вот фрагмент моего кода:

 <?php $ch = curl_init('http://apanel3.newfront.local/api'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 4); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"); $curlresult = curl_exec($curl_connection); print_r($curlresult); ?> 

Я пытаюсь вызвать свой api, используя следующий curl-код. Он вызывает indexAction. Даже подумал, что я установил curlopt_post в true, я не получаю желаемого результата.

Solutions Collecting From Web of "как вызвать restful zend controller usin curl в php?"