Frage

I've been able to get my tumblr info in this format:

Array
(
    [tumblelog] => Array
        (
            [title] => KingKai
            [description] => Here lies the conscience of Tukays.
            [id] => kingkai-theambitious
            [timezone] => US/Eastern
            [cname] => 
            [url] => http://kingkai-theambitious.tumblr.com/
        )

[stats] => Array
    (
        [num-all] => 3
        [num-regular] => 3
        [num-quote] => 0
        [num-photo] => 0
        [num-link] => 0
        [num-conversation] => 0
        [num-video] => 0
        [num-audio] => 0
        [num-inarray] => 3
    )

[posts] => Array
    (
        [1394414874|79118603794] => Array
            (
                [id] => 79118603794
                [url] => http://kingkai-theambitious.tumblr.com/post/79118603794
                [type] => regular
                [time] => 1394414874
                [mobile] => 
                [bookmarklet] => 
                [format] => html
                [tags] => 
                [content] => Array
                    (
                        [title] => Socious
                        [body] => <p>Skucha.</p>
                    )

            )

        [1394414755|76418897239] => Array
            (
                [id] => 76418897239
                [url] => http://kingkai-theambitious.tumblr.com/post/76418897239
                [type] => regular
                [time] => 1394414755
                [mobile] => 
                [bookmarklet] => 
                [format] => html
                [tags] => 
                [content] => Array
                    (
                        [title] => initium
                        [body] => <p>Sammy Solca started my career.</p>
<p>I do remember rapping with my long time friend and brother Kieran before that but it was initiated by Sammy. We spent a lot of time putting tracks together in his room using the ‘mic’ he had put together. We used Audacity at the time, a primitive software for recording audio, and Sammy would mix them for me. It’s always good to remember the first steps, those uncertain step, the experimental steps. I remember all that vividly for they pushed me into putting down my first few recorded songs at 15. I recall playing a few of the songs in Sammy’s room in a listening session. Solca was present, Lloyd was present, Ken (RIP) was present. They all told me how good they felt about it and motivated me, Lloyd occasionally played my music at school functions.

A few months later I out out a mixtape (my first) known as Spit & Run. The most popular song on the tape was an Oleku cover I did. I sold my mixtape both in and outside my college, I was helped by a few close friends and we managed to sell every single copy, I made quite a bit out of it but I never used the money for personal pleasures but rather ended up recycling it into studio time which is ironic because that was probably my greatest personal pleasure. The mixtape featured Lil shaker, Charles Quist Edi Young, Paapa and quite a few of Noah’s instrumentals. He had spent quite a bit if time on the beats he created and I spent a lot of time in his room just listening to him create them although I sensed he preferred it when he worked alone. 

I got love for the mixtape, so what? I got hate for the mixtape, so what? It was very amateur and hardly got any online plays for some of the songs. However, I did get a fee radio plays from popular Ghanaian radio stations. My manager and advisor and friend linked me up with a radio interview where I dropped freestyle raps. I had my toes in the industry, but the question was “what does a rapper do when he enters an industry which is predominantly Afro- beats?” He adapts. Kidkwame was no longer a sole entity. I found a brother that would be a part of the rest of my life. Enter Masta- T </p>
                    )

            )

        [1392211540|76422486050] => Array
            (
                [id] => 76422486050
                [url] => http://kingkai-theambitious.tumblr.com/post/76422486050
                [type] => regular
                [time] => 1392211540
                [mobile] => 
                [bookmarklet] => 
                [format] => html
                [tags] => 
                [content] => Array
                    (
                        [title] => Primus gradus,
                        [body] => <p>I told my parents I wanted to take my music to the studio and I needed a bit of financial help to do so cause it would cost a bit. The first thing that comes to mind when you hear the word ‘studio’ is music. The second thing may be speakers…or even a microphone…or even a producer. But the word studio also brings other things to mind: Drugs, alcohol, women, thugs etc. Bear in mind I came from a dominantly African background and my parents were very aware to these dangers and the possibility of me being exposed to the mentioned. But I wanted this more than anything else and my father new it was the music I sought after because he had invested a lot of money in me and my siblings when it came to music. I had started playing the piano since the age of 7. Piano lessons needs a teacher, a teacher needs a piano. I had also played the violin for a bit and I was confident when it came to creating my own music on the piano. Bearing this in mind my dad payed for my first ever recording session with the popular Lil Shaker who I have worked with for the bulk of my (what I term as) career, I was linked by Paapa (contemporary gospel artist) and I was accompanied by Noah beatz. I saw Jayso in the studio. I saw Edi Young in the studio. I saw Adina Thembi in the studio, I saw Rumour in the studio. I remember doing five cover songs: Spit & Run, Gasoline, Heart under water, Free mason cover and this one rock song cover. I never released any of those songs but I played them for my dad and he was impressed with them and promised to continue supporting my music as long as it didn’t affect my grades. </p>
<p>This wouldn’t be enough. Five recordings wouldn’t be enough. I found a new addiction. A new obsession.</p>
                    )

            )

    )

)

I'm using php how do I get each post? Any help? I know I can use the for each statement in php but how exactly do I go about this? Any suggestions?

War es hilfreich?

Lösung

I am going to assume you want to loop through the users posts.

To use foreach for this, you would do something like this.

$arr = array(); // this is your data

$posts = $arr['posts'];

foreach($posts as $key => $post) {
    // Now you can access the post data from $post
    // example
    echo $post['url'];
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top