Michiel
Michiel

Reputation: 133

How do i Fetch this data inside json array

I want to fetch data from this http://gdata.youtube.com/feeds/api/users/velosofy?v=2&alt=json I can get all the other data but i can't get the "countHint" inside the json array.

This is what i use to get for example the "display":

$realUserName = 'velosofy';
$data = file_get_contents('http://gdata.youtube.com/feeds/api/users/' . $realUserName . '
v=2&alt=json');
$data = json_decode($data, true);

echo 'displayname = '. $data['entry']['yt$username']['display'].'<br />';

My questions is: How can i echo the countHint of for example Subscriptions?

Upvotes: 0

Views: 85

Answers (2)

Riccardo
Riccardo

Reputation: 3

i believe the json structure changed: echo $data["entry"]['gd$comments']['gd$feedLink']["countHint"];

Upvotes: 0

Kumar V
Kumar V

Reputation: 8838

I'm getting count for your code:

echo $data["entry"]['gd$feedLink'][0]["countHint"];

If you use double quotation for gd$feedLink, it won't work as index string contain $feedlink. $feedlink will be consider as php variable. So Try with single quote.

Upvotes: 1

Related Questions