渲染Twitter标准搜索API

时间:2018-07-18 01:48:28

标签: php twitter

如何呈现Twitter标准搜索api

参考:

https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets.html

我的代码

require_once('TwitterAPIExchange.php');

$settings = array('oauth_access_token' => "XXX",'oauth_access_token_secret' => "XXX",'consumer_key' => "XXX",'consumer_secret' => "XXX");

$url = "https://api.twitter.com/1.1/search/tweets.json";

$requestMethod = "GET";

$getfield = "?q=#XXX from:XXX";

$twitter = new TwitterAPIExchange($settings);

$string = json_decode($twitter->setGetfield($getfield)->buildOauth($url, $requestMethod)->performRequest(),$assoc = TRUE);

if($string["errors"][0]["message"] != "") {echo "<h3>Sorry, there was a problem.</h3><p>Twitter returned the following error message:</p><p><em>".$string[errors][0]["message"]."</em></p>";exit();}

var_dump($string);

它给我的响应类似于上面的参考

我的问题是如何渲染它?我找不到与此有关的任何文档/示例吗?

像嵌入式时间表和oEmbedAPI

参考:

https://developer.twitter.com/en/docs/twitter-for-websites/timelines/overview https://developer.twitter.com/en/docs/twitter-for-websites/timelines/guides/oembed-api

0 个答案:

没有答案