Try using http://twitter.com/statuses/friends.xml instead.

On Sun, May 17, 2009 at 13:38, Lorraine <[email protected]> wrote:

> Hope someone can help. I'm trying to generate a list of names and
> screen_names of the people I'm following on Twitter. The problem is that it
> just prints the name and screen_name of the user with the latest update...
> over and over again. I'm a real newbie when it comes to PHP-- here's my
> code:
>
> <?php
> // set user/pswd
> $username = 'TwitterName';
> $password = 'twitterpassword';
>
> // create a new curl resource
> $ch = curl_init();
>
> // set URL and options
> curl_setopt($ch, CURLOPT_URL, "
> http://twitter.com/statuses/friends_timeline.xml";);
> curl_setopt($ch, CURLOPT_HEADER, false);
> curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
>
> // execute and pass to browser
> $str = curl_exec($ch);
>
> //print XML data (temporary)
> $xml = simplexml_load_string ($str);
>
> $username = $xml->status->user->name;
> $userscreenname = $xml->status->user->screen_name;
>
> foreach ($xml->status as $twit1) {
>
> echo "<p class='text'>".$username."</p>";//status
> echo "<p class='text'>".$userscreenname."</p>";//status
> }
>
> // close curl resource
> curl_close($ch);
>
> ?>
>
> What am I doing wrong?
>



-- 
Abraham Williams | http://the.hackerconundrum.com
Hacker | http://abrah.am | http://twitter.com/abraham
Web608 | Community Evangelist | http://web608.org
This email is: [ ] blogable [x] ask first [ ] private.

Reply via email to