I am trying to get PHP to control MPC (Media Player Classic) using the web interface. This is the site im following:
Anything using fsockopen wont work, I always get a blank page when I visit the .PHP page with no change to mpc (but using file_get_contents I can get the status.html page to give me info). Using fsockopen I have never received any error, I even tried fsockopen with a wrong random port to see what would happen, and it did give me an error (so it is apparently connection to MPC).

I tried:
1# Different ports
2# Disabling firewall
3# Different commands
4# Several other HTML/javascript tools to confirm MPC HC is able to take commands
5# Tried sending commands to /commands.html/ using GET instead of POST.
6# Tried wireshare to see whats happening (but wireshark does not seem to pick up the packets)
7# Tried removing the '@' to make sure there weren't warnings being hidden.

Here is Javascript code that works:



var data = new Object();
data[wmcName] = commandId;
if (paramName != undefined && paramName != null) {
data[paramName] = paramValue;
}

$.ajax({
type: "POST",
cache: false,
data: data,
url: '/command.html',
success: function(data) {
if (suppressRefresh != false) {
reloadData();
}
},
error: function() {
}
});



That code is running from: http://localhost:13579/ (which is the port that MPC is listening too, it also explains why the host/port is not specified).

How can I make this work with PHP (in other words, I want php to POST content)? I am out of ideas, if I can't get this fixed here ill probably just get the js code to ajax some PHP before it ajax mpc (but I want to avoid that as it is more messy then a pure PHP solution)....