Retrieve data from the Json Return

0

I'm getting a return from a URL in JSON, but I'm not able to retrieve the answers, so I get the first array and then another array that I can not recover

Code

   $json_file = file_get_contents("http://servidor.sys.net/sendsms?username=xxx&password=xxxx&phonenumber=999999999&message=ssssssss");

$json_str = json_decode($json_file, true);


var_dump( $json_str );

This is the return.

 array(2) {
  ["message"]=>
  string(8) "ssssssss"
  ["report"]=>
  array(1) {
    [0]=>
    array(1) {
      [1]=>
      array(1) {
        [0]=>
        array(4) {
          ["port"]=>
          string(7) "gsm-2.2"
          ["phonenumber"]=>
          string(11) "999999999"
          ["time"]=>
          string(19) "2017-08-04 07:34:35"
          ["result"]=>
          string(7) "success"
        }
      }
    }
  }
}
    
asked by anonymous 04.08.2017 / 01:40

1 answer

1

In this particular% wrapper, there is a% wrapper key that should be your question, then follow the example

<?php
   $array = array(
        "message" => 'ssssssss',
        "report" => array(
                array( 1 =>
                    array( 
                        array(
                              "port"=>"gsm-2.2",
                              "phonenumber"=>"999999999",
                              "time"=>"2017-08-04 07:34:35",
                              "result"=>"success"
                            )
                        )
                    )
            )
    );

   echo $array['message'];
   echo '<br>';
   echo $array['report'][0][1][0]['port'];
   echo '<br>';
   echo $array['report'][0][1][0]['phonenumber'];
   echo '<br>';
   echo $array['report'][0][1][0]['time'];
   echo '<br>';
   echo $array['report'][0][1][0]['result'];

Online Example

    
04.08.2017 / 02:04