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;
}
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)....
Do you have error reporting on? Is fsockopen disabled in your php.ini? Are you running the php through the MPC server/socket? The tutorial you showed doesn't have you doing that at but instead through Apache (probably since it is easier to debug any configuration/compatibility issues).
Error reporting is on with E_ALL.
fsockopen is not disabled (nothing listed in 'disable_functions')
Are you running the php through the MPC server/socket?
hmm, if I try to access anything PHP using the MPC port the PHP wont work (im not even sure how I would setup MPC to 'parse' PHP code). But if I access the same code using localhost without the port number the code will work (apache).
Once again, if I purposely put in the wrong port in my PHP code, ill get an fsock error. So its like the fsock is connecting to MPC but for whatever reason the commands im sending are being ignored by MPC.
Bookmarks