Hello, I am new to the php community
I have a problem with feedback code from api
I want to put a part in a variable
How is that ? please help
{“code”: 0, “reason”: “OK”, “resp”: “AT + CCFC = 1,3, " 92061460 \ “\ r \ nOK \ r \ n”}
I want to put between \ r \ Variable \ r
In this case is == nOK
some time
{“code”:0, “reason”:“OK”, “resp”:“AT+CCFC=1,3,” 92061460”\r\nERROR\r\n"}
in this case = nERROR
need echo $varible
i hope get your support
if that should be JSON it’s invalid. If you get some valid JSON, you can read/write it with
https://www.php.net/manual/en/function.json-decode.php
and the linked functions on the right.
i open the link but can’t understand
if you can give me an example with my text
{“code”: 0, “reason”: “OK”, “resp”: “AT + CCFC = 1,3, " 92061460 \ “\ r \ nOK \ r \ n”}
I want to put between \ r \ Variable \ r
In this case is == nOK
first you need a correct JSON, take an online validator and check it.
you mean $url=json_decode($url, true);
so, what should the JSON object look like and how are you currently creating it now?
i am new in php
but i think we can use explode
but don’t know how use it
Not what I asked …