php - Twitter OAuth - Get values from Array -


i'm attempting list of users searched term on twitter , far no luck. here's code:

$parameters = array('q' => '#puppy', 'count' => 2); $results = $connection->get('search/tweets', $parameters);  //print_r($result);  foreach ($results $data) {  ?>          <div id="update">             <div id="left"><a href="https://twitter.com/#!/<?php echo $data->user->screen_name; ?>" target="_blank"/><img width="48px" height="48px" src="<?php echo $data->user->profile_image_url; ?>"/></a></div>             <div id="right">                 <div class="user"><a href="https://twitter.com/#!/<?php echo $data->user->screen_name; ?>" target="_blank"/><?php echo $data->user->screen_name; ?></a>&nbsp;<?php echo $data->user->name; ?></div>                 <div class="detail">                 <?php echo $data->text; ?>                 </div>             </div>         </div> <?php } 

and outputs:

notice: undefined property: stdclass::$user in line 150 trying property of non-object in line 150 

i know i'm accessing array in weird way, can't figure out how needs be.

for out there may needing this, matter of getting right data array in right way. here's code used:

        $parameters = array('q' => '#puppy', 'count' => 2);         $results = $connection->get('search/tweets', $parameters);          $resultsuser = $results->statuses[0]->user;          $i = 0;         foreach ($results->statuses $data) {              $user_screen_name = $data->user->screen_name;             $user_profile_image_url = $data->user->profile_image_url;             $user_text = $data->text;          ?>                  <div id="update">                     <div id="left"><a href="https://twitter.com/#!/<?php echo $user_screen_name; ?>" target="_blank"/><img width="48px" height="48px" src="<?php echo $user_profile_image_url; ?>"/></a></div>                     <div id="right">                         <div class="user"><a href="https://twitter.com/#!/<?php echo $user_screen_name; ?>" target="_blank"/><?php echo $user_screen_name; ?></a>&nbsp;<?php echo $user_screen_name; ?></div>                         <div class="detail">                         <?php echo $user_text; ?>                          <hr/>                         </div>                     </div>                 </div>         <?php         $i++;         }           ?> 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -