Alright, this is really bothering me.
I’m trying to communicate with WP’s xml-rpc interface via Java, but I have found that their use of $HTTP_RAW_POST_DATA prevents me from writing to the http post request.
I’m testing on this file:
<?php
/* PRINT DEBUG INFO */
// Request method
println("Request Method: ".$_SERVER['REQUEST_METHOD']);
// HTTP_RAW_POST_DATA
println("HTTP_RAW_POST_DATA: ".$HTTP_RAW_POST_DATA);
// Input socket
$inputSocket = fopen('php://input','rb');
$contents = stream_get_contents($inputSocket);
fclose($inputSocket);
println("Input socket: ".$contents);
/* PRINT NICELY */
function println ($string) {
echo $string;
echo "
";
}
?>
In Java, I’m calling this page, and it’ll print different things for the input socket and raw post variable. On the PHP documentation, it is recommended to use the less processor intensive input stream, which I would, but WP has implemented the other (why, oh why!), and therefore it is receiving no content, and thinks that I didn’t make a POST request (they simply check whether that variable is blank or not…).
So, really, what makes the single predefined variable blank, while reading from the input stream works wonderfully?
[whisper]Thanks![/whisper]