My C++ is very rusty but the response codes are not coming from the PHP script per se. I think you need to investigate the C++ code. It obviously not really outputting what comes back from the PHP script. The -11 may mean it cannot properly interpret what comes back. If it is expecting HTML in return you may have some headers messed up in the PHP script. Keep in mind that nothing, not even white space can be output before headers.