note 98479 rejected from function.json-decode by nforbes
| From: | nforbes@php.net | Date: | Fri, 18 Jun 2010 14:52:35 +0000 |
| Subject: | note 98479 rejected from function.json-decode by nforbes | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-170242@lists.php.net to get a copy of this message | ||
Note Submitter: smithsaga at yahoo dot com
----
I am hitting the twitter api in wordpress using genesis framework and I pull the json file
(http://twitter.com/statuses/user_timeline/'. $instance['twitter_id']
.'.json?count=2), then when I use json_decode, I believe I am losing some information.
The json file has "statuses_count":999, so when I try to reference it in the array, it
renders nothing.
$json = json_decode($twitter); //$twitter is my JSON string
foreach( (array)$json as $tweet ) {
$count=$tweet->statuses_count; //$count was a string;
$tweet_text=$tweet->text; //works great!
break;}
I notice that when I refer to
All I want to get is the number into my variable $count.
Any help available?