Reputation: 671
I cannot find solution, so I am using XML-RPC protocol for getting data from the server and I need to request one command which server requires empty dictinary (" like this {} ", in python I can do it) but in PHP how can I make a request with empty dictionary in PHP?
server.list("Example", {}, user_id) //PYTHON
this above line works in Python and I got successful response from the server
BUT
$client->query("list", "Example", {}, $user_id); // PHP
this above line is not working and gives me error. I tried empty array but the server's response was that I have to give dictionary not array.
And I tried
$empty = array(""=>"");
$client->query("list", "Example", $empty, $user_id);
In this line the result was empty array, no any errors. I tried also with "NULL" and "" ( empty string ) but no any results and error!
How can execute this command in PHP like in a Python? Thanks a lot.
Upvotes: 2
Views: 1842
Reputation: 46607
Try (object) null
to get an 'empty' object. See here:
If an object is converted to an object, it is not modified. If a value of any other type is converted to an object, a new instance of the stdClass built-in class is created. If the value was NULL, the new instance will be empty.
Upvotes: 2