我可能大错特错了,但是我整个下午都在尝试在这个课间 PHP 框架教程中运行 Curl post 命令。我不明白的是 PHP 应该如何解释我的 POST,它总是以一个空数组的形式出现。
curl -i -X POST -d '{"screencast":{"subject":"tools"}}' \
http://localhost:3570/index.php/trainingServer/screencast.json
(这里的斜杠只是为了不让我看起来像个白痴,但是我在 Windows 中使用 PHP 5.2执行了这个命令,在 Linux 服务器上也试过,与 Linux curl 版本相同)
我一定漏掉了什么,因为它看起来非常简单,帖子只是没有被正确解释,如果是的话,一切都会很好。
这就是我得到的回报:
HTTP/1.1 409 Conflict
Date: Fri, 01 May 2009 22:03:00 GMT
Server: Apache/2.2.8 (Win32) PHP/5.2.6
X-Powered-By: PHP/5.2.6
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1
{"screencast":{"id":null,"subject":null,"body":null,
"dataUrl":null,"dataMedium":null,"createdOn":null,"author":null}}