- Where Developers Learn, Share, & Build Careers
I am trying to select a specific object in a JSON query. I have decoded it, and although I have spent a few hours searching for answers, I am unable to determine one for this specific case. I would like to select the URL from the blog response, although I can not go behind the array.
$ oauth-> Fetch ("http://api.tumblr.com/V2/user/ info"); $ Json = json_decode ($ oauth-> Milest Response ()); $ Url = $ json- & gt; Feedback-> User-> Blog; $ Url1 = array ($ url- & gt; url); // This line does not give me a URL - I get an array ([0] = & gt;) print_a ($ url1);
When I do not run the array, I give it:
array ([0] => stdClass object ([name] = & Gt; 12748784 [URL] = & gt; http://12748784.tumblr.com/ [followers] => [[primary] => 1 [title] = & gt; untitled [description] = > [Admin] = & gt; 1 [Update] => 1341883193 [Post] => 1 [Draft] => [[Message] => 4 [Queue] => 0 [asks] = & gt; 1 [ask_anon] = & gt; [tweet] => [Facebook] => n [facebook_opengraph_enabled] => n [type] = & public;))) ))
Thanks for any help you give me Can be. I'm finished with the search.
per tumbler documentation, blog
an array of objects, therefore, The array ($ url-> url)
does not make sense in your code in this $ url1 = $ url [0] - & gt; Url
, which looks terrible to me.
I want to do something else like this.
$ blog = $ json- & gt; Feedback-> User-> Blog; $ Urls = array (); Forex Currency ($ blog as $ object) {$ urls [] = $ object- & gt; Url; }
In this way you get all the blog URLs out of the object array. Does this make sense?
Comments
Post a Comment