How to get a variable from array when getting response from api call? : After successfully logging in for a 3rd party API access, using the following code:


    $response = Requests::post('https://apidomain.com/v3/account/login/api', $headers, $data);



When I print: 

    echo '<pre>'; print_r($response); echo '</pre>';

I get the following:

    Requests_Response Object
    (
        [body] => {"access_token":"blabla",".issued":"2019-07-30T02:47:14.4326684Z",".expires":"2019-08-01T02:47:14.4326686Z"}
        [raw] => HTTP/1.1 200 OK
    etc...


Now I want to access the access_token as a variable so that I can pass for further processing.

I tried to access like: $access_token=$response[body'] and $access_token=$response[1][body']

Unfortunately nothing worked.

Any help will be appreciated.