Array uitlezen

Status
Niet open voor verdere reacties.

terroraapje

Gebruiker
Lid geworden
14 sep 2010
Berichten
87
Hoi allemaal,


Ik heb een array waar ik niet uit kom.
PHP:
stdClass Object
(
    [request] => stdClass Object
        (
            [parameters] => stdClass Object
                (
                    [window] => d
                    [q] => #fb
                )

            [response_type] => json
            [resource] => search
            [url] => http://otter.topsy.com/search.json?q=%23fb&window=d
        )

    [response] => stdClass Object
        (
            [window] => d
            [page] => 1
            [total] => 38178
            [perpage] => 10
            [last_offset] => 10
            [hidden] => 0
            [list] => Array
                (
                    [0] => stdClass Object
                        (
                            [trackback_permalink] => http://twitter.com/rolandsmartin/status/132147782340448256
                            [trackback_author_url] => http://twitter.com/rolandsmartin
                            [content] => Some people should come with a warning label....So u know up front that they can make you sick! #FB
                            [trackback_date] => 1320341461
                            [topsy_author_img] => http://a2.twimg.com/profile_images/1581809445/kingmemorial_normal.jpg
                            [hits] => 168
                            [topsy_trackback_url] => http://topsy.com/twitter.com/jamalhbryant/status/132147380660355073?utm_source=otter
                            [firstpost_date] => 1320341386
                            [url] => http://twitter.com/jamalhbryant/status/132147380660355073
                            [trackback_author_nick] => rolandsmartin
                            [highlight] => Some people should come with a warning label....So u know up front that they can make you sick! #FB 
                            [topsy_author_url] => http://topsy.com/twitter/rolandsmartin?utm_source=otter
                            [mytype] => tweet
                            [score] => 15.2719
                            [trackback_total] => 165
                            [title] => Some people should come with a warning label....So u know up front that they can make you sick! #FB
                        )

Ik wil [content] hebben.

Dit is wat ik nu heb
PHP:
$data = json_decode(file_get_contents("http://otter.topsy.com/search.json?q=".$searchtag."&window=d"));
			$tweetlist = $data->response;

			foreach ($tweetlist->list as $tweet => $var)
			{
				echo "<pre>";
				print_r ($data);
				echo "</pre>";
				echo $tweet[$var]->content .'<br />';
		
		
	
			}

Ik wil dus [content] makkelijk kunnen uitlezen

ong op de manier zoals bij de laatste echo : echo $tweet[$var]->content .'<br />';
 
Als je foreach($tweetlist->list AS $tweet) doet dan kun je hem toch gewoon met $tweet->content opvragen?

PHP:
$data = json_decode(file_get_contents("http://otter.topsy.com/search.json?q=".$searchtag."&window=d"));

foreach($data->response->list AS $tweet) {
  echo $tweet->content;
}
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan