Hey guys im trying to finish my app but im stock on this..

i need to call a server for authentication (xtream codes)

i get back :

Code:
{

    "user_info": {
        "username": "u",
        "password": "p",
        "message": "",
        "auth": 1,
        "status": "Active",
        "exp_date": "1521306691",
        "is_trial": "0",
        "active_cons": "0",
        "created_at": "1518887491",
        "max_connections": "1",
        "allowed_output_formats": [
            "m3u8",
            "ts",
            "rtmp"
        ]
    },
    "server_info": {
        "url": "server",
        "port": "25461",
        "rtmp_port": "8001",
        "timezone": "Europe/London",
        "time_now": "2018-03-06 14:05:59"
    }
}
i have tried lots of ways to get username and passwrod from user_info

quick example

Code:
  $data = json_decode(file_get_contents($url), true);
        echo "id: ", $data['user_info']['username'];
        echo '<br>';
        echo "Name: ", $data['password'];
        echo '<br>';
or

Code:
$jfo = file_get_contents($json_file);
// read the title value
$title = $jfo->server_info->url;
// copy the posts array to a php var
$posts = $jfo->user_info->username;
or

Code:
$jsonStr = file_get_contents($url);
$dataObj = json_decode($jsonStr);
echo $dataObj->user_info->username;