Re: [請益] PHP如何接收POST過來的XML DOM ?
為什麼只能接收raw post data 呢?
為什麼 $_POST 就不行了呢?
想破頭了啊!!!...
-----------------domTest.html-------------------------------------
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=Big5">
<title>送出 XML DOM 物件</title>
<body>
<script language="JavaScript">
var strXML = "<book>";
strXML = strXML + "<code>F6476</code><booktitle>";
strXML = strXML + "ASP.NET 2.0網頁製作徹底研究</booktitle>";
strXML = strXML + "<author>陳會安</author>";
strXML = strXML + "<price>660</price>";
strXML = strXML + "</book>";
var xmlDom = new ActiveXObject("MSXML2.DOMDocument.6.0");
xmlDom.async = "false";
xmlDom.loadXML(strXML);
var httpRequest = new ActiveXObject("MSXML2.XMLHTTP.6.0");
httpRequest.open("POST", "domTest.php", false);
httpRequest.send(xmlDom);
var str = "伺服器狀態: " + httpRequest.status + " - ";
str = str + httpRequest.statusText;
document.write(str + "<br>");
xmlResult = httpRequest.responseText;
document.write(xmlResult);
</script>
</body>
</html>
-----------------domTest.php------------------------------------
<?php
$a = $_POST;
var_dump($a);
?>
-------------
傳回來的結果是空的陣列:array(0){}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 112.104.122.242
※ 編輯: jerryntcjc 來自: 112.104.122.242 (06/16 16:55)
→
06/16 22:51, , 1F
06/16 22:51, 1F
※ 編輯: jerryntcjc 來自: 123.205.243.26 (06/17 01:02)
→
06/17 01:03, , 2F
06/17 01:03, 2F
→
06/17 01:18, , 3F
06/17 01:18, 3F
→
06/17 01:19, , 4F
06/17 01:19, 4F
※ 編輯: jerryntcjc 來自: 123.205.243.26 (06/17 02:01)
→
06/17 02:02, , 5F
06/17 02:02, 5F
推
06/17 04:07, , 6F
06/17 04:07, 6F
→
06/17 04:08, , 7F
06/17 04:08, 7F
→
06/17 04:08, , 8F
06/17 04:08, 8F
→
06/17 14:27, , 9F
06/17 14:27, 9F
→
06/17 14:27, , 10F
06/17 14:27, 10F
→
06/17 14:30, , 11F
06/17 14:30, 11F
→
06/19 15:04, , 12F
06/19 15:04, 12F
→
06/19 15:05, , 13F
06/19 15:05, 13F
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):
PHP 近期熱門文章
PTT數位生活區 即時熱門文章