douzhongqiu5032
2009-11-21 08:27
浏览 28
已采纳

使用Zend_Rest_Client的Zend_Rest_Controller工作示例?

I am trying to write a short Rest Service with Zend Framework. But the documentation is not the best at this Part.

I have an ApiController extended Zend_Rest_Controller with all needed abstract methods. My goal is to get Post data and return something.

My client looks like this:

    public function indexAction()
    {
        $url = 'http://localhost/url/public/api';
        $client = new Zend_Rest_Client();
        $client->setUri($url);
        $client->url = 'http://www.google.de';
        $result = $client->post();
    }

but the provided "$client->url" is not inside the post array on Server side. Does I have to use Zend Rest Server inside the postAction on my ApiController?

If someone has an example how to send and to get the data with Zend Rest, that would be great.

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dongzhang1864 2009-11-21 09:28
    已采纳
    打赏 评论
  • douxi1968 2009-11-29 13:23

    Have you tried setting it to access 127.0.0.1 rather than localhost? I know this can cause issues sometimes.

    打赏 评论

相关推荐 更多相似问题