Ver Mensaje Individual
  #4 (permalink)  
Antiguo 25/10/2009, 10:37
Avatar de junihh
junihh
 
Fecha de Ingreso: febrero-2004
Ubicación: República Dominicana
Mensajes: 997
Antigüedad: 21 años, 1 mes
Puntos: 7
Respuesta: Activar los tag de enlaces en un listado de Twitter

Hola abimaelrc

Se que este post ya tiene algun tiempo, pero solo hasta ahora pude retomar este tema. Logre resolverlo con esta solucion. Aqui el codigo completo con algunos cambios al que mostre originalmente, espero le sirva a alguien mas:

Código PHP:
function getTweets ($cant)
{
        
        
$username 'twittterusername';
        
$idnumber 'twittteridnumber';
        
        
$twitter_feed 'http://twitter.com/statuses/user_timeline/' $idnumber '.rss';
        
$ctx stream_context_create(array('http' => array('timeout' => 1)));
        
$rawfeed = @file_get_contents($twitter_feed);
        
        if (
$rawfeed != FALSE)
        {
            
            
$xml = new SimpleXmlElement($rawfeed);
        
            for (
$i 0$i $cant$i++)
            {
                
$twt $xml->channel->item[$i]->description;
                
$twt str_replace ($username ': ',''$twt);
                
$twt ereg_replace ("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]""<a href=\"\\0\">\\0</a>"$twt);
                echo 
'<li>' $twt '<br/><a href="' $xml->channel->item[$i]->link '" target="_blank"><b>Leer tweet</b></a></li>';
            }
            
        } else {
            echo 
'<li>Parece que Twitter tiene ciertos problemas por el momento. Los mensajes se mostrarán cuando se restablezca el servicio, gracias.</li>';
        }
        

__________________
JuniHH
- Mi blog
- Mi portafolio

Última edición por junihh; 25/10/2009 a las 10:53