Thanks to Abraham for reminding me about var_dump which showed the
results as NULL.

At risk of outing myself as stupid I will do so anyway in case there
might be someone out there who has also been searching for how to do
this, from start to finish.

This code works. The stupid part was not putting the entire URL in the
get statement. I was errantly going by a different example. Assuming
you are familiar with Abraham's Oauth library,

  $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
$OAuthKey, $OAuthSecret);
  $userDeets = $connection->get('http://api.twitter.com/1/users/
lookup.json', array('screen_name' => 'biz, twitterapi'));

  //var_dump($userDeets);

  foreach ($userDeets as $item)
    {
      echo $item->screen_name . ": ";
      echo $item->followers_count;
      echo "<br>";
    }


On Apr 12, 3:31 pm, Gabe <[email protected]> wrote:
> Neither works. Am I processing the results correctly?
>
> On Apr 12, 3:25 pm, Abraham Williams <[email protected]> wrote:
>
>
>
>
>
>
>
> > Try:
>
> > $userDeets = $connection->get('users/lookup' array('screen_name' =>
> > 'biz,twitterapi'));
>
> > That should work.
>
> > Abraham
> > -------------
> > Abraham Williams | Hacker Advocate | abrah.am
> > <http://abrah.am>Just launched from Answerly <http://answerly.com>:
> > InboxQ<http://inboxq.com>for Chrome
> > @abraham <https://twitter.com/abraham> | github.com/abraham | blog.abrah.am
> > This email is: [ ] shareable [x] ask first [ ] private.
>
> > On Tue, Apr 12, 2011 at 12:15, Gabe <[email protected]> wrote:
> > > Hi,
> > > I have read all the users/lookup related posts and also scoured the
> > > internet looking for an appropriate example.I posted a question as a
> > > reply on one but don't see it so I am hoping someone can help a
> > > twitter api newbie.
>
> > > I just want to get results from users/lookup. I am using Abraham's
> > > Oauth library, which I have been able to get to work in other
> > > instances with no problems. I'm hoping it's my lack of understanding
> > > of how the syntax should be. Here is the code:
>
> > >  // all values populated correctly
> > >  $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
> > > $OAuthKey, $OAuthSecret);
> > >  // saw this example as correction of the following line; neither
> > > seems to work
> > >  $userDeets = $connection->get('/users/lookup.json',
> > > array('screen_name' => 'biz,twitterapi'));
> > >  // $userDeets = $connection->get('/users/lookup.json?
> > > screen_name=biz,twitterapi');
>
> > >  foreach ($userDeets as $item)
> > >    {
> > >      echo $item->followers_count;
> > >      echo "<br>";
> > >    }
>
> > > Thanks in advance for any insight.
>
> > > -Gabe
>
> > > --
> > > Twitter developer documentation and resources:http://dev.twitter.com/doc
> > > API updates via Twitter:http://twitter.com/twitterapi
> > > Issues/Enhancements Tracker:
> > >http://code.google.com/p/twitter-api/issues/list
> > > Change your membership to this group:
> > >http://groups.google.com/group/twitter-development-talk

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk

Reply via email to