Re: [twitter-dev] Re: Can't get the friend list of the logged in user (oAuth)

2010-08-12 Thread Tom van der Woerdt
On 8/12/10 1:59 PM, Rémy B wrote:
> Thanks Tom.
> 
> I have already tried these two. My problem is, I always get the "Rate
> limit exceeded. Clients may not make more than 150 requests per hour."
> error message, even if this is the first time I log in.
> I thought it could be possible if the user is logged in using oAuth.
> 
> Let's say I want to get the list of profiles followed by @Twitter:
> 
>  $curl = curl_init();
> curl_setopt($curl,CURLOPT_URL,"http://api.twitter.com/1/friends/ids/
> twitter.xml");
> curl_setopt($curl,CURLOPT_RETURNTRANSFER,true);
> $contenu = curl_exec($curl);
> $xml = new simpleXMLElement($contenu);
> print_r($xml);
> foreach ($xml->ids->id as $friend) {
>   echo $friend."";
> }
> ?>
> 
> What am I doing wrong?

Hi Rémy,

You are not doing anything wrong. I just tested that code and it works
fine. I'd say: wait an hour, and it will work.

You could (should) check the HTTP headers - they offer you information
about your current rate limit status.

I do get this error, but it is not related to the rate limit :
Warning: Invalid argument supplied for foreach() in
/Users/tom/Sites/test.php on line 9

Tom


Re: [twitter-dev] Re: Can't get the friend list of the logged in user (oAuth)

2010-08-11 Thread Tom van der Woerdt
On 8/11/10 2:13 PM, Rémy B wrote:
> I have been trying to find the solution but I can't seem to find the
> right method.
> How can I return the list of friends IDs of the authenticated (oAuth)
> user?
> 
> Thanks,
> Rémy

Hi Rémy,

http://dev.twitter.com/doc/get/friends/ids
http://dev.twitter.com/doc/get/followers/ids

These 2 should help you.

If by saying friends you mean mutual followers, then you should simply
combine these two lists.

Tom