使用api显示推文的codebird数组

时间:2014-02-06 11:15:44

标签: php arrays api twitter

好的,我正在使用codebird来使用php读写推文。这是一个受保护的Twitter帐户,因此我需要使用API​​在我们的专用网络上显示推文。我能够毫无问题地发推文,它正在检索我自己正在努力的推文。

$reply = (array) $cb->statuses_homeTimeline();
print_r($reply);

这给出了输出(这只是数组中的第一个)

Array ( [0] => stdClass Object ( [created_at] => Thu Feb 06 09:08:43 +0000 2014 [id] => 431353751824134144 [id_str] => 431353751824134144 [text] => test 3 [source] => web [truncated] => [in_reply_to_status_id] => [in_reply_to_status_id_str] => [in_reply_to_user_id] => [in_reply_to_user_id_str] => [in_reply_to_screen_name] => [user] => stdClass Object ( [id] => 2292936619 [id_str] => 2292936619 [name] => JPress Support [screen_name] => JPressSupport [location] => [description] => This is an automated account letting you know of any issues. Any tweets made to the account will not be seen. Thanks, Johnston Press IT. [url] => [entities] => stdClass Object ( [description] => stdClass Object ( [urls] => Array ( ) ) ) [protected] => 1 [followers_count] => 1 [friends_count] => 0 [listed_count] => 0 [created_at] => Wed Jan 15 16:11:20 +0000 2014 [favourites_count] => 0 [utc_offset] => 0 [time_zone] => Casablanca [geo_enabled] => [verified] => [statuses_count] => 3 [lang] => en-gb [contributors_enabled] => [is_translator] => [is_translation_enabled] => [profile_background_color] => C0DEED [profile_background_image_url] => http://abs.twimg.com/images/themes/theme1/bg.png [profile_background_image_url_https] => https://abs.twimg.com/images/themes/theme1/bg.png [profile_background_tile] => [profile_image_url] => http://pbs.twimg.com/profile_images/423490507906359297/t-ECTyZW_normal.png [profile_image_url_https] => https://pbs.twimg.com/profile_images/423490507906359297/t-ECTyZW_normal.png [profile_link_color] => 0084B4 [profile_sidebar_border_color] => C0DEED [profile_sidebar_fill_color] => DDEEF6 [profile_text_color] => 333333 [profile_use_background_image] => 1 [default_profile] => 1 [default_profile_image] => [following] => [follow_request_sent] => [notifications] => ) [geo] => [coordinates] => [place] => [contributors] => [retweet_count] => 0 [favorite_count] => 0 [entities] => stdClass Object ( [hashtags] => Array ( ) [symbols] => Array ( ) [urls] => Array ( ) [user_mentions] => Array ( ) ) [favorited] => [retweeted] => [lang] => et )

但是,如果我做了类似

的事情
<? echo $reply[0]; ?>

它没有输出。我猜这很简单,但我无法解决,请任何人帮忙,我只需要[text] =>

1 个答案:

答案 0 :(得分:0)

排序了!

$tweet1 = $reply[0]->text;