I am making a POST request from IE using XDomainRequest. XDomainRequest does not sent a Content-Type in his header and it is not possible to set a custom header. I think this causes PHP to not place the post variables in $_POST.
I can see the parameters are send if I use file_get_contents("php://input") but I am not sure how to parse them correctly without breaking them. Is there a way to force PHP to collect the POST parameters? Or how can I get the variables safely?
I am using this transport to get XDomainRequest in jQuery and make this call:
jQuery.post('http://domain.de/io/login', 'email=test2@stuff.de&password=xxx', function(response)
{
if (console) console.log(response);
alert('response: ' + objectToString(response));
});
On the PHP side I have:
print_r($_REQUEST, true);
echo file_get_contents("php://input");
Works fine with Firefox. But Firefox does not use the transport.
@hakre: Thanks a lot. Your document describes what no one here belives:
It also mentions parse_str() that does exactly what I needed.
Here my code to fill $_POST if it was not set by PHP:
I would love to give you reputation for this but I don’t know how. Anyway you just got +50 from me, so I hope that will be ok.