python - Json-made array in PHP is empty -


i have working python function , calling within php. python program puts final data structure json object.

json.dump(data) 

this working. when go view data in php doesnt give me anything.

$myarray = json_decode(exec(python_program), true) 

when print_r array, empty, nothing shows on screen. given python works correctly either json or php problem.

if knows doing wrong, i'd appreciate being explained!

see: http://php.net/manual/en/function.exec.php#116222

can’t output exec’d command appear in $output array? echo’ing on shell instead?

append "2>&1" end of command, example:

exec("xmllint --noout ~/desktop/test.xml 2>&1", $retarr, $retval);

will fill array $retarr expected output; 1 line per array key.


Comments