0

I am successfully pulling an array of list members (json) using twitters new v1.1 API. https://dev.twitter.com/docs/api/1.1/get/lists/members

However, the array is multidimensional and loaded with other user information. I'm hoping to get a simple array with only usernames, or comma separated string.

Does anyone have any idea how to go about pulling out all of the values with the key "screen_name"?

Thanks in advance!

EDIT

here is the structure. I think the issue is the objects being in the way. Not sure how to proceed.

stdClass Object ( 
    [users] => Array ( 
        [0] => stdClass Object ( 
            [id] => 1084301508 
            [id_str] => 1084301508 
            [name] => user name 
            [screen_name] => uName
         )
        [1] => stdClass Object ( 
            [id] => 1084363246 
            [id_str] => 1084363246 
            [name] => user name2 
            [screen_name] => uName2
         )
    )
)
4

1 回答 1

0

找到了我的解决方案。问题是在数组和对象中导航。可能有更清洁的方法可以做到这一点,但这对我有用。

foreach($tweets as $users){
    foreach($users as $user_info){
        echo $user_info->screen_name.",";
    }
}
于 2013-06-21T13:33:16.010 回答