2012-03-10 15 views
1

YahooのAPIとImからいくつかのデータを取得しようとしていますが、いくつかの問題があります。ここでJSONを使用してYahooのAPIからデータを取得

は、私はに実行している問題は、私は唯一の「トラック」の下のデータにできる午前であるヤフーのJSON出力

cbfunc({ 
"query": { 
    "count": 25, 
    "created": "2012-03-10T07:49:06Z", 
    "lang": "en-US", 
    "diagnostics": { 
    "publiclyCallable": "true", 
    "url": { 
    "execution-start-time": "2", 
    "execution-stop-time": "364", 
    "execution-time": "362", 
    "content": "http://us.music.yahooapis.com/track/v1/list/search/track/Madonna?start=1&count=25" 
    }, 
    "user-time": "369", 
    "service-time": "362", 
    "build-version": "25587" 
    }, 
    "results": { 
    "Track": [ 
    { 
    "discNumber": "1", 
    "duration": "0", 
    "explicit": "0", 
    "flags": "0", 
    "id": "31884342", 
    "label": "Touch and Go Records", 
    "popularity": "3", 
    "rating": "-1", 
    "releaseYear": "2003", 
    "rights": "160", 
    "title": "Madonna", 
    "trackNumber": "10", 
    "url": "http://new.music.yahoo.com/cocorosie/tracks/madonna--31884342", 
    "Artist": { 
     "catzillaID": "1927768063", 
     "flags": "57859", 
     "hotzillaID": "1808720053", 
     "id": "23301762", 
     "name": "Cocorosie", 
     "rating": "-1", 
     "trackCount": "118", 
     "url": "http://new.music.yahoo.com/cocorosie/", 
     "website": "http://www.cocorosieland.com/" 
    }, 
    "Album": { 
     "Release": { 
     "UPC": "036172095360", 
     "explicit": "0", 
     "flags": "2", 
     "id": "31881255", 
     "label": "Touch and Go Records", 
     "rating": "-1", 
     "releaseDate": "2003-09-20T07:00:00Z", 
     "releaseYear": "2003", 
     "rights": "160", 
     "title": "La Maison De Mon Rêve", 
     "typeID": "2", 
     "url": "http://new.music.yahoo.com/cocorosie/albums/maison-de-mon-reve--31881255", 
     "Image": [ 
     { 
     "size": "40", 
     "url": "http://d.yimg.com/ec/image/v1/release/31881255?size=40" 
     }, 
     { 
     "size": "65", 
     "url": "http://d.yimg.com/ec/image/v1/release/31881255?size=65" 
     }, 
     { 
     "size": "75", 
     "url": "http://d.yimg.com/ec/image/v1/release/31881255?size=75" 
     }, 
     { 
     "size": "80", 
     "url": "http://d.yimg.com/ec/image/v1/release/31881255?size=80" 
     }, 
     { 
     "size": "110", 
     "url": "http://d.yimg.com/ec/image/v1/release/31881255?size=110" 
     }, 
     { 
     "size": "135", 
     "url": "http://d.yimg.com/ec/image/v1/release/31881255?size=135" 
     }, 
     { 
     "size": "200", 
     "url": "http://d.yimg.com/ec/image/v1/release/31881255?size=200" 
     }, 
     { 
     "size": "300", 
     "url": "http://d.yimg.com/ec/image/v1/release/31881255?size=300" 
     }, 
     { 
     "size": "654", 
     "url": "http://d.yimg.com/ec/image/v1/release/31881255?size=654" 
     }, 
     { 
     "size": "800", 
     "url": "http://d.yimg.com/ec/image/v1/release/31881255?size=800" 
     } 
     ] 
     } 
    }, 

の抜粋です。私はより多くのデータを取得したいと思います。 「アルバム」と「アーティスト」の下のデータ。

ご協力いただければ幸いです。

答えて

0

あなたはforeachループ

+0

おかげ内

$Track->Artist->name $Track->Album->Release->label 

としてそれにアクセスすることができます。私は早くそれを試して、それは動作しませんでした。私は間違ったことをしたと思います。今働いている。ありがとう! – user1210772

関連する問題