Im new to php. I have following situation:
$params = array("code" => $_GET["code"], "redirect_uri" => $redirectUrl);
$response = $client->getAccessToken($accessTokenUrl, "authorization_code", $params);
$accessTokenResult = $response["result"];
$client->setAccessToken($accessTokenResult["access_token"]);
$client->setAccessTokenType(OAuth2\Client::ACCESS_TOKEN_BEARER);
$response = $client->fetch("https://oauth.reddit.com/api/v1/me.json");
And the result (print_r) from $response is this one:
Array (
[result] => Array
(
[name] => histograf
[created] => 12869553489
[gold_creddits] => 0
[created_utc] => 12869553489
[link_karma] => 1
[comment_karma] => 11
[over_18] => 1
[is_gold] =>
[is_mod] => 0
[has_verified_email] =>
[id] => ap11l
)
[code] => 200
[content_type] => application/json; charset=UTF-8 )
The point is now, how can I access the element name? I need to have the username to step further in the pgm.
I've tried these and none work:
$username = $response[0];$username = $response->name;$username = $response[0]name;