fork download
  1. <?php
  2. $json_str = '[{
  3. "numero":"1000",
  4. "log": [{
  5. "message": "testing connection to the target URL",
  6. "level": "INFO",
  7. "time": "10:24:05"
  8. }],
  9. "responsavel": [{
  10. "nome":"Responsavel teste"
  11. }]
  12. }]';
  13.  
  14. $obj = json_decode($json_str);
  15.  
  16. foreach ($obj as $objeto){
  17.  
  18. echo "numero: ".$objeto->numero;
  19.  
  20. foreach ($objeto->log as $item){
  21.  
  22. echo "Mensagem: ".$item->message. " - ";
  23. echo "NĂ­vel: ".$item->level. "</br>";
  24. }
  25.  
  26. foreach ($objeto->responsavel as $responsavel){
  27.  
  28. echo "NOME: ".$responsavel->nome;
  29.  
  30. }
  31.  
  32. }
Success #stdin #stdout 0.01s 82880KB
stdin
Standard input is empty
stdout
numero: 1000Mensagem: testing connection to the target URL - Nível: INFO</br>NOME: Responsavel teste