Fatal error: Cannot use object of type stdClass as array in
**/index.php on line
18
The code was working fine recently, but now, I suspect due to a PHP upgrade, is rendering the above referenced error message. I'm not really sure how to rectify something such as this, so any help would be greatly appreciated so I can get things running once again.
Line 18 is within the below code, it begins with "$first_tweet."
PHP Code:
<?php
if(isset($_POST['firstuser'])) {
$first_user = $_POST['firstuser'];
$twitter = new Twitter($requestusername, $requestpassword);
$user1errorstatus = false;
$results = false;
$user_first_info = json_decode($twitter->showUser("json", $first_user));
if(isset($user_first_info->error)) {
$user1errorstatus = true;
}
if($user1errorstatus == false) {
$num_tweets = $user_first_info->statuses_count;
$inpage = ceil($num_tweets / 20);
$userstats = $twitter->getUserTimeline($first_user, $inpage);
$userstats = json_decode($userstats);
$num_stats = count($userstats) - 1;
$first_tweet = $userstats[$num_stats]->text;
$results = true;
}
}
?>
Bookmarks