Формат твитов в twitter api 1.1

Я пытаюсь обновить учетную запись моего клиента, чтобы использовать новый API Twitter 1.1. Я провел много исследований и нашел здесь код здесь, в Stack Overflow, который указан здесь: https://github.com/J7mbo/twitter-api-php .

Итак, у меня есть код, работающий (по большей части), но вместо перечисления твитов я получаю список кода:

[{"created_at":"Wed Jun 12 13:06:28 +0000 2013","id":344802886762512386,"id_str":"344802886762512386","text":"Loading a #prefabarch for delivery the fun way #archkit #framing #razor https:\/\/t.co\/oh2WfbCPNi","source":"\u003ca href=\"http:\/\/vine.co\" rel=\"nofollow\"\u003eVine - Make a Scene\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":47689193,"id_str":"47689193","name":"Archways & Ceilings","screen_name":"Archking57","location":"Arlington, TX","description":"We supply framing kits for Dome Ceilings, Groin Vaults, Barrel Vaults, Coves, and Archways","url":"http:\/\/t.co\/FssCqf6lGz","entities":{"url":{"urls":[{"url":"http:\/\/t.co\/FssCqf6lGz","expanded_url":"http:\/\/www.archwaysandceilings.com","display_url":"archwaysandceilings.com","indices":[0,22]}]},"description":{"urls":[]}},"protected":false,"followers_count":351,"friends_count":88,"listed_count":10,"created_at":"Tue Jun 16 17:48:23 +0000 2009","favourites_count":0,"utc_offset":-21600,"time_zone":"Central Time (US & Canada)","geo_enabled":true,"verified":false,"statuses_count":331,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"000505","profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/223605213\/ACME-YOUTUBE-LOW-QUALITY.jpg","profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/223605213\/ACME-YOUTUBE-LOW-QUALITY.jpg","profile_background_tile":true,"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/1927262664\/ACME_Logo_normal.jpg","profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1927262664\/ACME_Logo_normal.jpg","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/47689193\/1362599335","profile_link_color":"560AFA","profile_sidebar_border_color":"850D2B","profile_sidebar_fill_color":"020501","profile_text_color":"CF0830","profile_use_background_image":true,"default_profile":false,"default_profile_image":false,"following":null,"follow_request_sent":false,"notifications":null},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":0,"favorite_count":0,"entities":{"hashtags":[{"text":"prefabarch","indices":[10,21]},{"text":"archkit","indices":[47,55]},{"text":"framing","indices":[56,64]},{"text":"razor","indices":[65,71]}],"symbols":[],"urls":[{"url":"https:\/\/t.co\/oh2WfbCPNi","expanded_url":"https:\/\/vine.co\/v\/blvep6iJVzp","display_url":"vine.co\/v\/blvep6iJVzp","indices":[72,95]}],"user_mentions":[]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"lang":"en"},{"created_at":"Wed Jun 12 12:15:41 +0000 2013","id":344790103782207489,"id_str":"344790103782207489","text":"Learn how to design, plan and build arched ceilings http:\/\/t.co\/YXr6rVNnjL #vr4smallbiz","source":"\u003ca href=\"http:\/\/www.verticalresponse.com\" rel=\"nofollow\"\u003eVerticalResponse\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":47689193,"id_str":"47689193","name":"Archways & Ceilings","screen_name":"Archking57","location":"Arlington, TX","description":"We supply framing kits for Dome Ceilings, Groin Vaults, Barrel Vaults, Coves, and Archways","url":"http:\/\/t.co\/FssCqf6lGz","entities":{"url":{"urls":[{"url":"http:\/\/t.co\/FssCqf6lGz","expanded_url":"http:\/\/www.archwaysandceilings.com","display_url":"archwaysandceilings.com","indices":[0,22]}]},"description":{"urls":[]}},"protected":false,"followers_count":351,"friends_count":88,"listed_count":10,"created_at":"Tue Jun 16 17:48:23 +0000 2009","favourites_count":0,"utc_offset":-21600,"time_zone":"Central Time (US & Canada)","geo_enabled":true,"verified":false,"statuses_count":331,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"000505","profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/223605213\/ACME-YOUTUBE-LOW-QUALITY.jpg","profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/223605213\/ACME-YOUTUBE-LOW-QUALITY.jpg","profile_background_tile":true,"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/1927262664\/ACME_Logo_normal.jpg","profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1927262664\/ACME_Logo_normal.jpg","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/47689193\/1362599335","profile_link_color":"560AFA","profile_sidebar_border_color":"850D2B","profile_sidebar_fill_color":"020501","profile_text_color":"CF0830","profile_use_background_image":true,"default_profile":false,"default_profile_image":false,"following":null,"follow_request_sent":false,"notifications":null},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":0,"favorite_count":0,"entities":{"hashtags":[{"text":"vr4smallbiz","indices":[75,87]}],"symbols":[],"urls":[{"url":"http:\/\/t.co\/YXr6rVNnjL","expanded_url":"http:\/\/p0.vresp.com\/l2fZaa","display_url":"p0.vresp.com\/l2fZaa","indices":[52,74]}],"user_mentions":[]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"lang":"en"}] 

Я не могу понять, где я ошибся! Ниже приведен код PHP:

 require_once('include/twitter-api-php-master/TwitterAPIExchange.php'); $settings = array( 'oauth_access_token' => "MYKEY", 'oauth_access_token_secret' => "MYKEY", 'consumer_key' => "MYKEY", 'consumer_secret' => "MYKEY" ); $url = 'https://api.twitter.com/1.1/statuses/user_timeline.json'; $getfield = '?screen_name=archking57&count=2&exclude_replies=true'; $requestMethod = 'GET'; $twitter = new TwitterAPIExchange($settings); echo $twitter->setGetfield($getfield) ->buildOauth($url, $requestMethod) ->performRequest(); в require_once('include/twitter-api-php-master/TwitterAPIExchange.php'); $settings = array( 'oauth_access_token' => "MYKEY", 'oauth_access_token_secret' => "MYKEY", 'consumer_key' => "MYKEY", 'consumer_secret' => "MYKEY" ); $url = 'https://api.twitter.com/1.1/statuses/user_timeline.json'; $getfield = '?screen_name=archking57&count=2&exclude_replies=true'; $requestMethod = 'GET'; $twitter = new TwitterAPIExchange($settings); echo $twitter->setGetfield($getfield) ->buildOauth($url, $requestMethod) ->performRequest(); 

Поэтому мой вопрос: почему он не показывает только твиты? Как я могу отформатировать его в твиты?

Итак, вы возвращаетесь – это json , который является стандартным форматом ответа API Twitter.

Использование json_decode() PHP:

 $result = $twitter->setGetfield($getfield)->buildOauth($url, $requestMethod)->performRequest(); var_dump(json_decode($result));` 

Вы получите что-то похожее на это:

введите описание изображения здесь

Это больше похоже на данные, которые вам нужны?