0

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?

3
  • 1
    print_r($data) So we can see the structure of the array... Commented Jan 8, 2014 at 15:10
  • here is the print_r($data) pastebin.com/reTse5Zc Commented Jan 8, 2014 at 15:13
  • you are getting $ sign inside the string. this may cause the issue. Commented Jan 8, 2014 at 15:14

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.