Hopefully the solution to this is a lot more simple than what I've been trying!
I've got a Symfony 2.3 app where I'm attempting to get the number of followers of a Twitter users account. I get back data but I can't access it by array key/index values.
Controller Action:
public function twitterAction(){
$twitterClient = $this->container->get('guzzle.twitter.client');
$response = $twitterClient->get('1.1/followers/ids.json?screen_name=ACCOUNTNAME')
->send()->json();
return $this->render('CatablogSiteBundle:Default:status.html.php', array('response' => $response));
}
View:
<?php
var_dump($response);
echo '<br><br>';
echo gettype($response);
echo '<br><br>';
echo $response[0];
?>
I get back data that I want to use from var_dump, gettype responds with type Array , and attempting to reference $response[0] will fail completely.
What can I do to access data inside the response Object?
edit:
Of course I can't echo $response[0] ... (wrong type) don't try and code tired guys. Solved whilst going over NHG's answer, which is still helpful for anyone having problems with Guzzle.