Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> JSON
szczawik
post
Post #1





Grupa: Zarejestrowani
Postów: 52
Pomógł: 0
Dołączył: 19.08.2010

Ostrzeżenie: (0%)
-----


Witam jak wyświetlić wartości z tego linka?
http://api.jamendo.com/get2/id+name+url+im...ratingweek_desc
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
szczawik
post
Post #2





Grupa: Zarejestrowani
Postów: 52
Pomógł: 0
Dołączył: 19.08.2010

Ostrzeżenie: (0%)
-----


Wyświetliłem w tablicy
  1. $array = (array)json_decode($homepage);

efekt:
  1. (
  2. [images] => stdClass Object
  3. (
  4. [image] => stdClass Object
  5. (
  6. [title] =>
  7. [url] => <a href="http://www.last.fm/music/Ewa+Farna/+images/57591921" target="_blank">http://www.last.fm/music/Ewa+Farna/+images/57591921</a>
  8. [dateadded] => Thu, 20 Jan 2011 15:56:58
  9. [format] => png
  10. [owner] => stdClass Object
  11. (
  12. [name] => maddie_XD
  13. [url] => <a href="http://www.last.fm/user/maddie_XD" target="_blank">http://www.last.fm/user/maddie_XD</a>
  14. [@attr] => stdClass Object
  15. (
  16. [type] => user
  17. )
  18.  
  19. )
  20.  
  21. [sizes] => stdClass Object
  22. (
  23. [size] => Array
  24. (
  25. [0] => stdClass Object
  26. (
  27. [#text] => <a href="http://userserve-ak.last.fm/serve/_/57591921/Ewa+Farna.png" target="_blank">http://userserve-ak.last.fm/serve/_/57591921/Ewa+Farna.png</a>
  28. [name] => original
  29. [width] => 248
  30. [height] => 371
  31. )
  32.  
  33. [1] => stdClass Object
  34. (
  35. [#text] => <a href="http://userserve-ak.last.fm/serve/126/57591921.png" target="_blank">http://userserve-ak.last.fm/serve/126/57591921.png</a>
  36. [name] => large
  37. [width] => 126
  38. [height] => 188
  39. )
  40.  
  41. [2] => stdClass Object
  42. (
  43. [#text] => <a href="http://userserve-ak.last.fm/serve/126s/57591921.png" target="_blank">http://userserve-ak.last.fm/serve/126s/57591921.png</a>
  44. [name] => largesquare
  45. [width] => 126
  46. [height] => 126
  47. )
  48.  
  49. [3] => stdClass Object
  50. (
  51. [#text] => <a href="http://userserve-ak.last.fm/serve/64/57591921.png" target="_blank">http://userserve-ak.last.fm/serve/64/57591921.png</a>
  52. [name] => medium
  53. [width] => 64
  54. [height] => 96
  55. )
  56.  
  57. [4] => stdClass Object
  58. (
  59. [#text] => <a href="http://userserve-ak.last.fm/serve/34/57591921.png" target="_blank">http://userserve-ak.last.fm/serve/34/57591921.png</a>
  60. [name] => small
  61. [width] => 34
  62. [height] => 51
  63. )
  64.  
  65. [5] => stdClass Object
  66. (
  67. [#text] => <a href="http://userserve-ak.last.fm/serve/252/57591921.png" target="_blank">http://userserve-ak.last.fm/serve/252/57591921.png</a>
  68. [name] => extralarge
  69. [width] => 252
  70. [height] => 377
  71. )
  72.  
  73. )
  74.  
  75. )
  76.  
  77. [votes] => stdClass Object
  78. (
  79. [thumbsup] => 38
  80. [thumbsdown] => 3
  81. )
  82.  
  83. )
  84.  
  85. [@attr] => stdClass Object
  86. (
  87. [artist] => Ewa Farna
  88. [page] => 1
  89. [perPage] => 1
  90. [totalPages] => 224
  91. [total] => 224
  92. )
  93.  
  94. )
  95.  
  96. )

teraz próbuje wyciągnąć
  1. $text = '#text';
  2. print $array[0]->images->image->sizes->size[0]->$text;


Za mało wiedzy mam (IMG:style_emoticons/default/biggrin.gif)
W manualu tylko proste przykłady są
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 28.12.2025 - 00:48