I've written a simple JSON RPC server in python as an interface to a python program. The server works fine when I use curl to to manually construct JSON requests from it. When I use the JSON library from here: http://jsonrpcphp.org/ I just get an error response "Array" in return.
I'm not exactly sure what I'm doing wrong, because I've tested the server and it works when I don't use the PHP library.
I've check and the content type is set to "application/json".
Heres the PHP code:
$server= new jsonRPCClient("http://$serveraddress:$port");
try {
echo($server->do_stop());
} catch (Exception $e) {
echo "caught exception: ", $e->getMessage() ,"<br />";
}
EDIT:
Here's a print_r of the $server object (localhost should have http:// before it but I can't Put it in):
jsonRPCClient Object ( [debug:jsonRPCClient:private] => [url:jsonRPCClient:private] => localhost:3000[id:jsonRPCClient:private] => 1 [notification:jsonRPCClient:private] => [proxy] => )
do_stop() just raises an exception "Request Error: Array"
EDIT2: Solved the rpoblem, turns out that I was requesting an incorrect method. I forgot that I changed the name to stop().
Logic errors...