I have made a script that searches for specific twitter tweets. The problem is that it displays the whole array, and I want to display only the username and the tweet.
function searchHashtag($search,$count){
$consumerKey = "xxx";
$consumerSecret = "xxx";
$oauthAccessToken = "xxx";
$oauthAccessTokenSecret = "xxx";
$twitter = new TwitterOAuth($consumerKey, $consumerSecret, $oauthAccessToken, $oauthAccessTokenSecret);
$url = "https://api.twitter.com/1.1/search/tweets.json";
$tweetArray = array();
$parameters = array('q' => $search, 'result_type' => 'recent', 'count' => $count);
$tweets = $twitter->get($url,$parameters);
foreach($tweets->statuses as $tweet){
$tweetArray[] = array('text'=>$tweet->text, 'username'=>$tweet->user->name);
}
return $tweetArray;
}
$landbouw = searchHashtag($searchlandbouw,$countlandbouw);
var_dump($landbouw);
I know I can use return $tweetArray[1][1]; Then it displays only the username, but it also displays the amount of characters. Is there a easy way to display only the username and tweet, one by one?
echo "<pre>"; print_r($tweetArray); echo "</pre>";& Paste it on pastebin.com & share the url.