Hello,

Is it even possible to use abrahams twitteroauth library to get all
the followers the way I want it. I screwed up and now I must rewrite
the cursor idea, Is anybody having a example code for the abrahams
twitteroauth.

Thank you

On 25 jun, 21:50, Sam Wierema <samwier...@gmail.com> wrote:
> Yes, it's very possible. Haven't tested it, but it should be something
> like this:
>
> $cursor = -1;
> while( $cursor !== 0 ) {
>     $info = $oauth->get( 'statuses/followers', array( 'cursor' =>
> $cursor ) );
>     if( $oauth->http_code === 200 && !isset( $info->error ) ) {
>         // Count or whatever here
>         $cursor = $info->next_cursor;
>     }
>
> }
>
> If you just want to count all of your followers, why not do users/
> show? That contains a followers_count variable in it.
>
> On Jun 25, 4:18 pm, Rick <rickstuivenb...@gmail.com> wrote:
>
> > Thank you for your reply.
>
> > I don't use next_cursor or whatsoever. I just use the $followers
> > variable to use count it with $totaal = count($followers); so I can
> > use it in my code. The cursor code I posted before is the only thing I
> > use to try and get information.
>
> > Is it even possible to get all the followers with the abrahams twitter
> > library?
>
> > On 25 jun, 15:11, Sam Wierema <samwier...@gmail.com> wrote:
>
> > > You should not increment your cursor, because Twitter returns a cursor
> > > for you. And if cursor is 0, it means that there are no more pages (-1
> > > + 1 = 0).
>
> > > Check your $followers variable that you got from the first call. It
> > > should be called something like next_cursor.
>
> > > On Jun 25, 2:26 pm, Rick <rickstuivenb...@gmail.com> wrote:
>
> > > > Howdy!
>
> > > > I am currently making my application OAuth compatible from basic auth,
> > > > currently I have a issue I need to get resolved in order to switch to
> > > > the new OAuth method.
>
> > > > I am getting my followers from: $oauth->get('statuses/followers'); but
> > > > that only gives me the last 100 followers, I trought it would be easy
> > > > to do it this way:
>
> > > > $cursor = -1;
> > > > $followers = $oauth->get('statuses/followers', array('cursor' =>
> > > > $cursor));
> > > > // Other code here..
>
> > > > $cursor++;
> > > > $followers = $oauth->get('statuses/followers', array('cursor' =>
> > > > $cursor));
>
> > > > Is it possible to get all my users, because this code does not work
> > > > and my inspiration was wrong.
>
> > > > Hopefully you can help me.
>
> > > > Regards,
>
> > > > Rick

Reply via email to