-2

我想知道有没有办法做这样的事情来获取用户最近的推文?因此,用户将输入他们的推特名称,这可以获得他们最近的帖子。

4

2 回答 2

1

尝试使用这个(PHP):

$username="user"; // set user name
$format="json"; // set format
$tweet=json_decode(file_get_contents("http://api.twitter.com/1/statuses/user_timeline/$username.$format")); // get tweets and decode them into a variable

echo $tweet[0]->text; // show latest tweet

有关更多信息,请查看

jQuery 示例:

$.getJSON("http://twitter.com/statuses/user_timeline/username.json?callback=?", function(data) {
     $("#twitter").html(data[0].text);
});
于 2012-04-22T02:40:16.890 回答
0

您正在寻找Twitter API

于 2012-04-22T02:39:54.820 回答