Php 使用Zend_Rest_客户端删除
我正在尝试使用ZF1 rest客户端删除资源Php 使用Zend_Rest_客户端删除,php,zend-framework,Php,Zend Framework,我正在尝试使用ZF1 rest客户端删除资源 $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-123
$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
你知道如何使用这门课吗
谢谢
这不仅仅是路径,而是完整的URI。它细分为:
- 路径:
service/YOUR_UUID.json
- 查询信息:
api\u key=您的api\u key
$client = new Zend_Rest_Client('https://exeample.com');
$client->api_key(YOUR_API_KEY);
$response = $client->restClient->delete('/service/'.$this->uuid.'.json);
有关详细信息,请参阅如何在请求中传递参数。“
?
”是HTTP URI中的保留字符,如果要在URI路径中使用它,需要对其进行百分比编码。在您的代码中,您没有对其进行编码。我尝试了这种方法,但得到了以下结果:错误:simplexml_load_string():^@user3174311:恭喜,您已经解决了无法再获得“路径XXX不是有效的HTTP路径”错误的问题。那正是你问的,不是吗?当然,现在我有一个不同的问题。感谢您迄今为止的帮助顺便说一句,这种方法的工作原理相同(simplexml错误除外)$client=newZend_Rest_client(')$客户端->api_密钥(您的_api_密钥)->删除();是的,Zend_Rest_客户端也有类似的方法。请参见我在问题下的第一条评论中链接的另一个答案。如果XML无效,simplexml\u load\u string
将给出错误。你需要在那里寻找错误。
$client = new Zend_Rest_Client('https://exeample.com');
$client->api_key(YOUR_API_KEY);
$response = $client->restClient->delete('/service/'.$this->uuid.'.json);