I’m using cPanel xml-api class and its json output gives me the following when creating a user account,
I’ve passed an invalid username here .
What I require is to store the output in a variable and check if it is successful or not,
Output :
{"result":[{"status":0,"statusmsg":"Sorry, that username is reserved.","rawout":null,"options":null}]}
if($result->status=1) then it will print success otherwise print failure also is it possible to print the errormsg with the failure msg.
Thanks
You’ll want to start by
decodingthe response string into PHP types:Then, you can pull the status of the first result as if it were nested in an array: