以 html 格式获取推特 api

get twitter api in html format

我用twitteruser_timelineapi拉推文,在那里我发现了一个属性名字text,我可以得到[=24=中的推文吗? ] 格式,以便我的超链接可以在我的循环中开始工作以显示。

我正在为 php

使用 TwitterAPIExchange.php
$url = 'https://api.twitter.com/1.1/statuses/user_timeline.json';
$getfield = '?username=arpia';
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($settings);
$tw=$twitter->setGetfield($getfield)
             ->buildOauth($url, $requestMethod)
             ->performRequest();      

如何显示链接的 #tags 上传的图片和其他 html entities

你可以使用这个功能:

   function linkify_tweet($tweet) {

  //Convert urls to <a> links
  $tweet = preg_replace("/([\w]+\:\/\/[\w-?&;#~=\.\/\@]+[\w\/])/", "<a target=\"_blank\" href=\"\"></a>", $tweet);

  //Convert hashtags to twitter searches in <a> links
  $tweet = preg_replace("/#([A-Za-z0-9\/\.]*)/", "<a target=\"_new\" href=\"http://twitter.com/search?q=\">#</a>", $tweet);

  //Convert attags to twitter profiles in <a> links
  $tweet = preg_replace("/@([A-Za-z0-9\/\.]*)/", "<a href=\"http://www.twitter.com/\">@</a>", $tweet);

  return $tweet;

}

在此处找到:http://www.jacobtomlinson.co.uk/2014/01/22/convert-tweet-hashtags-at-tags-and-urls-to-links-with-php-and-regular-expressions/