S
S
SteepNET2020-01-21 16:22:14
PHP
SteepNET, 2020-01-21 16:22:14

Convert to JSON?

Good afternoon! I make a script in it from the console I output data in this way

$output = shell_exec("asterisk -rx 'database show DND'");
echo "$output";

The conclusion is like this
/DND/711                                          : YES                      
/DND/726                                          : YES                      
/DND/769                                          : YES                      
/DND/771                                          : YES                      
/DND/779                                          : YES                      
5 results found.

You need to trim the spaces, remove /DND/ , leave only
726: YES and give this to JSON ..
I tried explode(), json_encode() It turns out nonsense, confused, please help ..

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question