$xml =
simplexml_load_file('http://twitter.com/statuses/user_timeline/123456789.xml');
$statuses = array();
foreach ($xml->status as $status)
{
$text = htmlspecialchars($status->text);
$text=preg_replace( "/(?<!<a
href=\")((http)+(s)?:\/\/[^<>\s]+)/i", "<a href=\"\\0\"
target=\"_blank\">\\0</a>", $text );
$statuses[] = array(
'text' => $text,
'created_at' => $status->created_at,
'short_date' => date('M d', strtotime($status->created_at)),
);
}
That preg stuff is for converting URLs into HTML a tags. Change
123456789 to your twitter ID.
On Thu, Sep 2, 2010 at 4:37 PM, Harvey Kane <[email protected]> wrote:
> Hi All,
>
> Just got an email from Twitter saying the authentication system is changing
> for Twitter apps as from 2 days ago. Probably not so coincidentally, a site
> that displays recent tweets stopped working - It's getting 401 errors when
> it tries to connect.
>
> Can anyone recommend a basic Twitter PHP class that works with the new oauth
> authentication? I just need to get the latest X tweets into an array so I
> can display them on the site. Nothing more.
>
> Cheers,
>
> Harvey.
>
> --
> Harvey Kane
>
> Phone:
> - Auckland: +64 9 950 4133
> - Wanaka: +64 3 746 8133
> - Mobile: +64 21 811 951
>
> Email: [email protected]
> If you need to contact me urgently, please read my email policy
> www.ragepank.com/email/
>
> --
> NZ PHP Users Group: http://groups.google.com/group/nzphpug
> To post, send email to [email protected]
> To unsubscribe, send email to
> [email protected]
--
Blue Horn Ltd - System Development
http://bluehorn.co.nz
--
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]