Okay, habe es geschafft und bekomme die Informationen, die ich benötige.
Neues Problem:
<?php
ini_set('display_errors', 1);
require_once('TwitterAPIExchange.php');
/** Set access tokens here - see: https://dev.twitter.com/apps/ **/
$settings = array(
'oauth_access_token' => "xxx",
'oauth_access_token_secret' => "xxx",
'consumer_key' => "xxx",
'consumer_secret' => "xxx"
);
/** URL for REST request, see: https://dev.twitter.com/docs/api/1.1/ **/
$url = 'https://api.twitter.com/1.1/search/tweets.json';
$requestMethod = 'GET';
/** Perform a GET request and echo the response **/
/** Note: Set the GET field BEFORE calling buildOauth(); **/
$url = 'https://api.twitter.com/1.1/search/tweets.json';
$getfield = '?q=#hashtag&result_type=recent';
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($settings);
$response = $twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest();
$response = json_decode($response, true); //tried with and without true - throws class error without it.
foreach($response['statuses'] as $tweet)
{
echo '<hr>';
echo $tweet['text'];
echo '<br>';
echo $tweet['id'];
echo '<br>';
echo $tweet['name'];
echo '<br>';
echo $tweet['screen_name'];
echo '<br>';
echo $tweet['profile_image_url'];
}
echo "<pre>";
echo var_dump($response);
echo "</pre>";
$tweet['text']&['id'] werden ausgegeben, sowie alle breaks.
$tweet['name']['screen_name']['profile_image_url'] werden nicht ausgegeben.. Weiß jemand wieso?
Edit: Hab es hinbekommen, ['name']['screen_name'] und ['profile_image_url'] sind Unterpunkte...
echo '<hr>';
echo $tweet['text'];
echo '<br>';
echo $tweet['id'];
echo '<br>';
echo $tweet["user"]['name'];
echo '<br>';
echo $tweet["user"]['screen_name'];
echo '<br>';
echo $tweet["user"]['profile_image_url'];