$mentions_decode should be an array. Try something like

foreach ($mentions_decode as $status) {
  echo "@" . $status->user->screen_name . " just mentioned me";
}

Abraham

On Tue, Mar 16, 2010 at 20:01, Cassidy <cassc...@gmail.com> wrote:

> Like many others who post on these type of boards, I'm going to first
> mention that I'm a newb.
>
> Note: I'm using the PHP library TwtterLibPHP (http://github.com/jdp/
> twitterlibphp)
>
> I'm trying to pull out various pieces of information (in this case the
> user name) using the status/mentions method in the json format and
> while it works, it keeps giving me the followin g notice:
>
> "Notice: Undefined index: screen_name in /opt/lampp/htdocs/xampp/
> twitter/index.php on line 18"
>
> I searched online for an answer, some mentioned to just hide the
> notice, but that doesn't really fix it...anybody have an idea to
> resolve this?
>
> Thanks,
> Cassidy
>
> Here is my code snippet:
>
> <?php
> require_once('twitlib/twitter.lib.php');
>
> $username = 'theusername';
> $password = 'thepassword';
>
> $twitter = new Twitter($username, $password);
>
> $mentions = $twitter->getMentions(array('page'=>1), 'json');
>
> $mentions_decode = json_decode($mentions);
>
> echo "@" . $mentions_decode['screen_name'] . " just mentioned me"; \
> \The line giving me the notice
>
> ?>
>



-- 
Abraham Williams | Community Advocate | http://abrah.am
TwitterOAuth | http://github.com/abraham/twitteroauth
This email is: [ ] shareable [x] ask first [ ] private.

Reply via email to