使用Zend_Rest_Client删除

时间:2014-05-25 17:38:09

标签: php zend-framework

我正在尝试使用ZF1 rest client

删除资源
$this->restClient = new Zend_Rest_Client('https://myurl.com');
$response = $this->restClient->delete('/service/'.$this->uuid.'.json?api_key='.$this->apikey);

但是我收到了错误:

Path "/service/v-2149d050-c64b-0131-33b0-1231390c0c78.json?api_key=a-9a136a00-b340-0131-2662-1231390c0c78" is not a valid HTTP path

Web服务文档只是说使用

DELETE  https://myurl.com/service/YOUR_UUID.json?api_key=YOUR_API_KEY

关于如何使用这个类的任何想法?

感谢

1 个答案:

答案 0 :(得分:0)

DELETE  https://myurl.com/service/YOUR_UUID.json?api_key=YOUR_API_KEY

路径,而是完整的URI。它分解为:

  • 路径:service/YOUR_UUID.json
  • 查询信息:api_key=YOUR_API_KEY

对于Zend rest客户端,您需要为每个参数调用一个函数,并且不能将参数命名为标准HTTP谓词:

$client = new Zend_Rest_Client('https://exeample.com');
$client->api_key(YOUR_API_KEY);

$response = $client->restClient->delete('/service/'.$this->uuid.'.json);

有关详细信息,请参阅the Request Arguments section in the vendor documentation,了解如何通过请求传递参数。

相关问题