how do you get a specific values inside a returned JSON from a twitter API and placed it on a HTML/CSS
markup?
for example i have this returned from API
{"id":24876424,
" id_str":"24876424",
"name":"james bond",
"screen_name":"jbond",
"location":"tokyo",
"description":"this is my tweet"
} ...
我只想获取name
anddescription
部分并将其放入<div>
.
<div class="twett">
<div id="name"> "name" </div>
<div id="desc"> "description </div>
</div>
这是我的 PHP 代码,以防您需要查看
$url = 'https://api.twitter.com/1.1/statuses/user_timeline.json';
$getfield = '?screen_name=jbond&count=1';
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($settings);
echo $twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest();
?>