0

First of All Hello! So i am currently writing an online app that fetches tweets with any inputted Hashtag from Twitter but it's the first time i am working with the Twitter API or JSON in this scale. So this is just the beginning of the code that i am having problems with (Access Token and Consumer Keys are deleted for obvious reasons):

<?php
ini_set('display_errors', 1);
require_once('TwitterAPIExchange.php');
$settings = array(
    'oauth_access_token' => "",
    'oauth_access_token_secret' => "",
    'consumer_key' => "",
    'consumer_secret' => ""
);

$targetHashTag = '#CambrigeAnalytica';

$url = 'https://api.twitter.com/1.1/search/tweets.json';
$requestMethod = 'GET';
$getfield = '?q=' . $targetHashTag;
$twitter = new TwitterAPIExchange($settings);
$output = $twitter->setGetfield($getfield)
         ->buildOauth($url, $requestMethod)
         ->performRequest();
$tweets = json_decode($output, true);

?>

I actually want just three things from each tweet that finds by who, the Text and the date. Like shown in the picture below. How i can do that? JSON RESPONSE

Thanks in advance, Nick

NicktehPro
  • 89
  • 8

0 Answers0