2
考慮一個PHP腳本,所有輸出數據POST
,如下所示:發帖XML而不使用鍵/值對
<?php var_dump($_POST); ?>
腳本位於http://example.com/foo.php
。
現在,我想使用命令行curl
向其發佈XML數據(不使用鍵/值對)。我曾嘗試以下的許多變化:
curl -H "Content-type: text/xml; charset=utf-8" --data-urlencode "<foo><bar>bazinga</foo></bar>" http://example.com/foo.php
然而,他們都不真正張貼任何 - 根據PHP腳本,$_POST
只是一個空數組。
我在這裏做錯了什麼?
感謝,使用'的file_get_contents( 'PHP://輸入')的''而不是$ _POST'的伎倆! – 2010-05-16 19:45:17