I'm trying to create a simple piece of PHP code to display tweets using the twitter API, that just displays tweets about EVE Online - as a test. The code below does work however, I get the following error PHP notice after it:
A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: pages/about.php
Line Number: 17
Here is my code:
<?php include('twitteroauth.php');?>
<?php include('get_tweet.php');?>
<div id="tweets">
<?php
$tweets = $twitter->get('https://api.twitter.com/1.1/search/tweets.jsonq=EveOnline&
result_type=recent&count=10' );
foreach($tweets as $tweet)
{
foreach($tweet as $t)
{
echo '<div id="tweetwrap"><img src="'.$t->user->profile_image_url.'"/>'
.$t->text.'</div>';
}
}
?>
</div>
I'm not using CodeIgniter's controllers or methods to do this. I'm trying to do it outside of CodeIgniter whilst using CodeIgniter for everything else. I'm sure there's a way, however I don't understand why CodeIgniter displays errors when I'm not using any of it's controllers or methods.
I've also tried this:
echo '<div id="tweetwrap"><img src="'.$t->user['profile_image_url'].'"/>'
.$t['text'].'</div>';
But this also does not work. Please help.