【问题标题】:Get the json data获取json数据
【发布时间】:2013-10-15 18:02:45
【问题描述】:

我只是在尝试使用 Twitter API 进行简单的身份验证,我得到了 json 值。我像往常一样阅读了 json 内容,一切正常。当我从 tweets url 获取 json 时,我无法读取 tweets 值。

下面是从urlhttp://api.twitter.com/1.1/statuses/user_timeline.json获取json数据的方法

Array ( [0] => stdClass Object ( [created_at] => Tue Oct 08 13:40:08 +0000 2013 [id] => 3.8757312415518E+17 [id_str] => 387573124155183104 [text] => Keep冷静并阅读您的统计数据。12 个新关注者和 4 个取消关注者。每日统计来自http://t.co/9XzBTh21tj [来源] => JustUnfollow [截断] => [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] => 501484306

我称对象为

$tweet=$content->text;
echo $tweet;

请任何人帮助我仅从 json 数据中获取推文。

【问题讨论】:

    标签: json twitter


    【解决方案1】:

    好的..!!我得到了答案。

    echo $tweets[0]->text;
    

    这解决了我的问题。

    【讨论】:

      猜你喜欢
      • 2023-03-30
      • 1970-01-01
      • 2021-02-07
      • 2012-06-20
      • 2018-05-12
      • 2021-07-16
      • 2020-01-22
      • 2018-03-18
      相关资源
      最近更新 更多