<?php
$json_string = '{
"access_token": "ab5f49438xfbc2df2a6a927a02b5c2e2442am982c71ee8re4aee1b2c64783ddc7cab4050ed05d6aa",
"token_type": "Bearer",
"expires_in": 300,
"refresh_token": "ab4156db100f148b6cgd7e17097e1f1c25dcf32a53ec64w287c0bcc5b8f8aa2d0799a413567b8d73",
"scope": "user_account send_currency currency_exchange"
}';
echo "<pre>";
echo "access_token :" . $json_parse->access_token . PHP_EOL;
echo "token_type :" . $json_parse->token_type . PHP_EOL;
echo "expires_in :" . $json_parse->expires_in . PHP_EOL;
echo "refresh_token :" . $json_parse->refresh_token . PHP_EOL;
echo "scope :" . $json_parse->scope . PHP_EOL;
echo "</pre>";
// Transforma o escopo das variáveis acessíveis externamente
// O item deve ser um array, como o json_decode transforma em objeto
// precisamos transformar em array
echo "<pre>";
echo "access_token :" . $access_token . PHP_EOL;
echo "token_type :" . $token_type . PHP_EOL;
echo "expires_in :" . $expires_in . PHP_EOL;
echo "refresh_token :" . $refresh_token . PHP_EOL;
echo "scope :" . $scope . PHP_EOL;
echo "</pre>";
PD9waHAKCiRqc29uX3N0cmluZyA9ICd7CiAgICAiYWNjZXNzX3Rva2VuIjogImFiNWY0OTQzOHhmYmMyZGYyYTZhOTI3YTAyYjVjMmUyNDQyYW05ODJjNzFlZThyZTRhZWUxYjJjNjQ3ODNkZGM3Y2FiNDA1MGVkMDVkNmFhIiwKICAgICJ0b2tlbl90eXBlIjogIkJlYXJlciIsCiAgICAiZXhwaXJlc19pbiI6IDMwMCwKICAgICJyZWZyZXNoX3Rva2VuIjogImFiNDE1NmRiMTAwZjE0OGI2Y2dkN2UxNzA5N2UxZjFjMjVkY2YzMmE1M2VjNjR3Mjg3YzBiY2M1YjhmOGFhMmQwNzk5YTQxMzU2N2I4ZDczIiwKICAgICJzY29wZSI6ICJ1c2VyX2FjY291bnQgc2VuZF9jdXJyZW5jeSBjdXJyZW5jeV9leGNoYW5nZSIKfSc7CgokanNvbl9wYXJzZSA9IGpzb25fZGVjb2R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