I'm running a CURL in PHP and if I var_dump
the response, I get the following and I'm saving as $response
:
{
"name": "Bob Smithy",
"email": "testing@gmail.com",
"email_verified": false,
"connection": "Username-Password-Authentication",
"user_id": "f8d305bb49a3",
"provider": "auth0",
"picture": "https://secure.gravatar.com/avatar/a2da375af0228d88aed6b723e6764a94?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fbs.png",
"nickname": "Bob Smithy",
"identities": [
{
"connection": "Username-Password-Authentication",
"user_id": "f8d305bb49a3",
"provider": "auth0",
"isSocial": false
}
],
"updated_at": "2015-08-05T21:11:56.202Z",
"created_at": "2015-08-05T21:11:56.202Z"
}
What I need to do is get the value for user_id
that's under identities
. I know I need to do json_decode
, but then I can't figure out how to structure the rest. I know this doesn't work:
$dec_respo = (json_decode($response, true));
$new_data = $deco_respo['identities']['user_id'];
What should I be doing here to get this value?