- substr: documentation ( source)
- var_dump: documentation ( source)
- strpos: documentation ( source)
- json_decode: documentation ( source)
<?php
$str ='HTTP/1.1 200 OK
Server: YYYYYYYYY
Content-Type: application/json
Content-Length: 163
X-OAPI-Request-Id: XXXXXXXXXXXXXX
{
"token_type": "berber",
"access_token": "XXXXXXXXYYYYYYY",
"expires_in": "7776000"
}';
$arr = json_decode(substr($str,strpos($str,"{")), true);
Var_dump($arr);