我正在使用XDomainRequest從IE發出POST請求。 XDomainRequest不會在其標題中發送Content-Type,它是not possible to set a custom header。我認爲這會導致PHP不把post變量放在$_POST
。如何獲取錯誤標題的POST參數
我可以看到參數發送如果我使用file_get_contents("php://input")
但我不知道如何正確解析它們而不會破壞它們。有沒有辦法強制PHP收集POST參數?或者我怎樣才能安全地獲得變量?
我使用this transport得到XDomainRequest在jQuery和撥打這個電話:
jQuery.post('http://domain.de/io/login', '[email protected]&password=xxx', function(response)
{
if (console) console.log(response);
alert('response: ' + objectToString(response));
});
在PHP端我有:
print_r($_REQUEST, true);
echo file_get_contents("php://input");
正常工作與Firefox瀏覽器。但Firefox不使用傳輸。
POST變量不會奇蹟般地消失,即使某些標題不存在或不存在。請顯示代碼如何發出請求。 – CodeCaster
'我認爲這會導致PHP不把post變量放在$ _POST中。「這個錯誤的斷言是你的薄弱環節。事實回來! :) –
切出一些示例代碼並不容易。但是怎麼可能php://輸入包含變量而$ _REQUEST沒有?我可以看到的唯一區別是我從'getallheaders()' – PiTheNumber