php - How do I get the ErrorCode variable value from the response variable after message sending using CURL? -


after executing curl getting $result variable value as:

 {     "errorcode": "000",     "errormessage": "success",     "jobid": "6878b812-766d-48a2-9dae-2b0edf2d84d4",     "messagedata": [{         "number": "919730842844",         "messageparts": [{             "msgid": "919730842844-64a40d7611f94c03bea1045fdfa9bac5",             "partid": 1,             "text": "\u0027messagecontentsmstest\u0027"         }]     }]   } 

now need check errorcode == 000, how can value of individually errorcode?

this response received json.

so thought decode json_decode:

$chk = json_decode($result); echo $chk->errorcode;

or can try in way like,

$array = json_decode($result, true); echo $array['errorcode'];


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -