can';不要在php中使用restful服务

can';不要在php中使用restful服务,php,web-services,rest,post,restful-url,Php,Web Services,Rest,Post,Restful Url,我使用restful服务是为了用php发出get和post请求,这是一个现成的代码,它在get过程中运行良好,但在发布时不起作用,我只分配将传递给函数的参数,例如: $resp = httpRequest("http://wordpress.org/", 80, "POST", "/support/topic/junk-after-document-element-breaking-feed", array("replies" => "3")); 若服务

我使用restful服务是为了用php发出getpost请求,这是一个现成的代码,它在get过程中运行良好,但在发布时不起作用,我只分配将传递给函数的参数,例如:

 $resp = httpRequest("http://wordpress.org/",
        80, "POST", "/support/topic/junk-after-document-element-breaking-feed",
        array("replies" => "3"));

若服务未提供此方法,则不能对服务的url使用post方法。 即使服务在“获取”时应答,也不允许我们相信它在“发布”时应答

大致上这是两个分离的链接

GET  /weather - return some content (or 404 if not exist).
POST /weather - return another content (or 404 if not exist).

遵循http标准或REST方法是开发人员的责任。如果服务文档没有使用POST方法描述请求,那么很可能没有此类API(即使您看到REST sign market手册)。

您在
$resp
中得到了什么?404未找到页面为什么weather.yahooapi.com应该在POST上回答?RSS请求部分只讨论GET。因此,通常情况下,您使用错误的方法请求了一个现有URL,或者请求了一个不存在的URL。发送
OPTIONS
请求以获取所有可用的方法。404不是无效方法的正确响应。