Sorry no, I don't have any PHP 4 project at the moment. I guess you could replace simplexml_load_file function with whatever is available in PHP 4 for parsing XML string?
On Fri, Sep 3, 2010 at 9:57 PM, Admin <[email protected]> wrote: > > That's brilliant Sid... Thank you. > > Anything that'll run under PHP 4 though? (This is something we've been > beating against for a while, so I almost screamed in joy when this thread > appeared.) > > Cheers... > >> $xml = >> simplexml_load_file('http://twitter.com/statuses/user_timeline/1234567 >> 89.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. > > > > --- > Karl > > -- > 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]
