Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6541719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:08:22+00:00 2026-05-25T11:08:22+00:00

I’m parsing a JSON array returned from YouTube, and while doing so I created

  • 0

I’m parsing a JSON array returned from YouTube, and while doing so I created a new array with the contents of entry it returns. I then put that array into a foreach loop and try to access the info I need. When I do this echo $d->title->type outputs text (which is it’s value), but when I try to get the title of the video $d->title->$t doesn’t work. The following is the output I’m working with. The two pieces of info I need out of this array are the previously mentioned which is the title of the video and $d->media$group->media$content->url which is the url used to deploy on the iPhone.

[{"id":{"$t":"http:\/\/gdata.youtube.com\/feeds\/api\/videos\/jPF1JA6n054"},"published":{"$t":"2010-09-21T17:36:05.000Z"},"updated":{"$t":"2011-08-18T16:43:57.000Z"},"category":[{"scheme":"http:\/\/schemas.google.com\/g\/2005#kind","term":"http:\/\/gdata.youtube.com\/schemas\/2007#video"},{"scheme":"http:\/\/gdata.youtube.com\/schemas\/2007\/categories.cat","term":"Music","label":"Music"},{"scheme":"http:\/\/gdata.youtube.com\/schemas\/2007\/keywords.cat","term":"Back"},{"scheme":"http:\/\/gdata.youtube.com\/schemas\/2007\/keywords.cat","term":"Pocket"},{"scheme":"http:\/\/gdata.youtube.com\/schemas\/2007\/keywords.cat","term":"Memory"},{"scheme":"http:\/\/gdata.youtube.com\/schemas\/2007\/keywords.cat","term":"Back Pocket Memory"},{"scheme":"http:\/\/gdata.youtube.com\/schemas\/2007\/keywords.cat","term":"guitar"},{"scheme":"http:\/\/gdata.youtube.com\/schemas\/2007\/keywords.cat","term":"vocals"},{"scheme":"http:\/\/gdata.youtube.com\/schemas\/2007\/keywords.cat","term":"Awesome"},{"scheme":"http:\/\/gdata.youtube.com\/schemas\/2007\/keywords.cat","term":"drums"},{"scheme":"http:\/\/gdata.youtube.com\/schemas\/2007\/keywords.cat","term":"bass"},{"scheme":"http:\/\/gdata.youtube.com\/schemas\/2007\/keywords.cat","term":"amazing band"},{"scheme":"http:\/\/gdata.youtube.com\/schemas\/2007\/keywords.cat","term":"amazing guitar"},{"scheme":"http:\/\/gdata.youtube.com\/schemas\/2007\/keywords.cat","term":"fun"},{"scheme":"http:\/\/gdata.youtube.com\/schemas\/2007\/keywords.cat","term":"funny"},{"scheme":"http:\/\/gdata.youtube.com\/schemas\/2007\/keywords.cat","term":"cats"},{"scheme":"http:\/\/gdata.youtube.com\/schemas\/2007\/keywords.cat","term":"cute puppies"},{"scheme":"http:\/\/gdata.youtube.com\/schemas\/2007\/keywords.cat","term":"Obama"},{"scheme":"http:\/\/gdata.youtube.com\/schemas\/2007\/keywords.cat","term":"star wars"},{"scheme":"http:\/\/gdata.youtube.com\/schemas\/2007\/keywords.cat","term":"gaga"},{"scheme":"http:\/\/gdata.youtube.com\/schemas\/2007\/keywords.cat","term":"sexy"}],"title":{"$t":"Back Pocket Memory : 'Bergerac' Official Music Video","type":"text"},"content":{"$t":"Our official music video for the single from our album, 'Strangers'. Made by our amazing friends at 18mm Productions. Check them out at: www.18mmproductions.com. youtube.com\/18mmproductions, and Twitter: @18mmproductions. Enjoy the video, we are proud to see all of your lovely faces in it!","type":"text"},"link":[{"rel":"alternate","type":"text\/html","href":"http:\/\/www.youtube.com\/watch?v=jPF1JA6n054&feature=youtube_gdata"},{"rel":"http:\/\/gdata.youtube.com\/schemas\/2007#video.responses","type":"application\/atom+xml","href":"http:\/\/gdata.youtube.com\/feeds\/api\/videos\/jPF1JA6n054\/responses"},{"rel":"http:\/\/gdata.youtube.com\/schemas\/2007#video.related","type":"application\/atom+xml","href":"http:\/\/gdata.youtube.com\/feeds\/api\/videos\/jPF1JA6n054\/related"},{"rel":"http:\/\/gdata.youtube.com\/schemas\/2007#mobile","type":"text\/html","href":"http:\/\/m.youtube.com\/details?v=jPF1JA6n054"},{"rel":"self","type":"application\/atom+xml","href":"http:\/\/gdata.youtube.com\/feeds\/api\/videos\/jPF1JA6n054"}],"author":[{"name":{"$t":"BackPocketMemory"},"uri":{"$t":"http:\/\/gdata.youtube.com\/feeds\/api\/users\/backpocketmemory"}}],"gd$comments":{"gd$feedLink":{"href":"http:\/\/gdata.youtube.com\/feeds\/api\/videos\/jPF1JA6n054\/comments","countHint":19}},"media$group":{"media$category":[{"$t":"Music","label":"Music","scheme":"http:\/\/gdata.youtube.com\/schemas\/2007\/categories.cat"}],"media$content":[{"url":"http:\/\/www.youtube.com\/v\/jPF1JA6n054?f=videos&app=youtube_gdata","type":"application\/x-shockwave-flash","medium":"video","isDefault":"true","expression":"full","duration":244,"yt$format":5},{"url":"rtsp:\/\/v8.cache3.c.youtube.com\/CiILENy73wIaGQme06cOJHXxjBMYDSANFEgGUgZ2aWRlb3MM\/0\/0\/0\/video.3gp","type":"video\/3gpp","medium":"video","expression":"full","duration":244,"yt$format":1},{"url":"rtsp:\/\/v7.cache5.c.youtube.com\/CiILENy73wIaGQme06cOJHXxjBMYESARFEgGUgZ2aWRlb3MM\/0\/0\/0\/video.3gp","type":"video\/3gpp","medium":"video","expression":"full","duration":244,"yt$format":6}],"media$description":{"$t":"Our official music video for the single from our album, 'Strangers'. Made by our amazing friends at 18mm Productions. Check them out at: www.18mmproductions.com. youtube.com\/18mmproductions, and Twitter: @18mmproductions. Enjoy the video, we are proud to see all of your lovely faces in it!","type":"plain"},"media$keywords":{"$t":"Back, Pocket, Memory, Back Pocket Memory, guitar, vocals, Awesome, drums, bass, amazing band, amazing guitar, fun, funny, cats, cute puppies, Obama, star wars, gaga, sexy"},"media$player":[{"url":"http:\/\/www.youtube.com\/watch?v=jPF1JA6n054&feature=youtube_gdata_player"}],"media$thumbnail":[{"url":"http:\/\/i.ytimg.com\/vi\/jPF1JA6n054\/0.jpg","height":360,"width":480,"time":"00:02:02"},{"url":"http:\/\/i.ytimg.com\/vi\/jPF1JA6n054\/1.jpg","height":90,"width":120,"time":"00:01:01"},{"url":"http:\/\/i.ytimg.com\/vi\/jPF1JA6n054\/2.jpg","height":90,"width":120,"time":"00:02:02"},{"url":"http:\/\/i.ytimg.com\/vi\/jPF1JA6n054\/3.jpg","height":90,"width":120,"time":"00:03:03"}],"media$title":{"$t":"Back Pocket Memory : 'Bergerac' Official Music Video","type":"plain"},"yt$duration":{"seconds":"244"}},"gd$rating":{"average":4.9322033,"max":5,"min":1,"numRaters":59,"rel":"http:\/\/schemas.google.com\/g\/2005#overall"},"yt$statistics":{"favoriteCount":"42","viewCount":"4813"}}]}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:08:23+00:00Added an answer on May 25, 2026 at 11:08 am

    $ is not a valid character in a PHP variable name. If your JSON parser returns associative arrays, try this:

    $d['title']['$t']
    

    If the parser returns objects then that won’t work. In that case, try this workaround:

    $d->title->{'$t'}
    

    You will have to use this syntax whenever JSON keys contain characters that are not valid PHP variable names, which includes all names containing $.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I want use html5's new tag to play a wav file (currently only supported
I am currently running into a problem where an element is coming back from
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.