2
我有一個POST方法POST值XML包含"的PHP被截斷
$ab = $_POST['xml'];
XML數據如下:
<email CommunicationType="Email" SourceSystem="GPS" TemplatePageZone="" brand="THORN" channel="THORN" emailAddr="[email protected]" template="tttt_09999_TEST">
<communicationTypes>
<communicationType Name="EMAIL" Value="[email protected]" isRequired="Y" />
<communicationType MobileTemplateID="12345" Name="COMM" OptInUrl="OptInUrl" Value="1234567890" isPartialOrFull="" isRequired="Y" template="88888" />
</communicationTypes>
<name firstName="**SMITH"** SON" lastName="" middleInitial="" />
<order orderDate="05/16/2013" orderHeaderKey="287346JSDV" orderIdATG="THORN01-23423415" orderNoEOMS="THORN01-22324323015" >
<creditCard card="" numbersss="" />
<digitalCoupons digitalCouponTotal="0.00" />
<lineItems />
</order>
<account atgProfileId="" cirisID="" info="" password="" />
<comments />
</email>
$xmlmain = simplexml_load_string($ab);
的問題是$ xmlmain無法加載$ab
,因爲特殊字符的SMITH"
永遠SMITH被截斷後的事情。我向自己發送了變量$xmlmain
的EMAIL,我看到截斷後的所有內容。這也導致了以下失敗,因爲沒有讀取XML。
$template_XMLMAIN = $xmlmain->attributes()->template; //This should be tttt_09999_TEST
爲什麼我不能讀取XML?謝謝。
PS:這是XML將被髮送到我的方式,不能將其從客戶端改變了我。
我有沒有問題加載該XML,你確定你不是意外解碼html實體嗎?或者他們在POST正文中發送未編碼的&&? (在這種情況下,你可以手動解析'php:// input')。 – Wrikken
我想這$ RAWDATA =的file_get_contents( 'PHP://輸入');並且在特殊字符的位置之後的所有內容都被截斷。 – user2391785
你的意思是數據甚至不在'php:// input'中? – Wrikken