Language:

Displaying the tweets of a profile on Twitter via PHP

14 February 2011 | In Web | 2,2 thousand views | By

Click & share: 


Let's learn how < a href = "#" rel = "nofollow" onclick = "Pal1266590383hw. aqkqhblqnaj (" easy "); return false;" style = "cursor: hand; color: # 000066; text-decoration: underline; border-bottom: dotted 1px;" onmouseover = "Pal1266590383hw. hwShow (event, this easy ", "); this.style.cursor = "; this.style.textDecoration = " hand " underline this.style.borderBottom = " solid "; ";" onmouseout = "Pal1266590383hw; hideMaybe (this, " easy "); this.style.cursor = "; this.style.textDecoration = " hand " underline this.style.borderBottom = " "; dotted 1px oncontextmenu =" " "; return false;" > easy view the tweets from any profile in Twitter on a page written in PHP. THE from of this mold you can < a href = "#" rel = "nofollow" onclick = "Pal1266590383hw. aqkqhblqnaj (" create "); return false;" style = "cursor: hand; color: # 000066; text-decoration: underline; border-bottom: dotted 1px;" onmouseover = "Pal1266590383hw. hwShow (event, this, " create "); this.style.cursor = "; this.style.textDecoration = " hand " underline this.style.borderBottom = " solid "; ";" onmouseout = "Pal1266590383hw; hideMaybe (this, " create "); this.style.cursor = "; this.style.textDecoration = " hand " underline this.style.borderBottom = " "; dotted 1px oncontextmenu =" " "; return false;" > create your customized page and displaying it as you wish .

Let's Schedule!

We will get the values via XML Feed. It's a relatively simple file, but that treat the entire < a href = "#" rel = "nofollow" onclick = "Pal1266590383hw. aqkqhblqnaj (" information "); return false;" style = "cursor: hand; color: # 000066; text-decoration: underline; border-bottom: dotted 1px;" onmouseover = "Pal1266590383hw. hwShow (event, this information ", "); this.style.cursor = "; this.style.textDecoration = " hand " underline this.style.borderBottom = " solid "; ";" onmouseout = "Pal1266590383hw; hideMaybe (this, " info "); this.style.cursor = "; this.style.textDecoration = " hand " underline this.style.borderBottom = " "; dotted 1px oncontextmenu =" " "; return false;" > information that we need original shape and concrete .

Let the script:

<?php
$usuario = 'dicasemgeral'; // Usuário do Twitter
$feed = 'http://twitter.com/statuses/user_timeline/'.$usuario.'.rss'; // Apenas o URL do Feed
$limite = 10; // Limite te Tweets que aparecerão na tela
?>
<html>
<head>
<title>Tweets de <?=$usuario;?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<?php
$conta=0;
foreach(simplexml_load_file($feed)->channel->item as $item ): if($conta>=$limite){break;} $conta++;
$username = $usuario;
$nome = explode(':',$item->title); $nome = $nome[0];
$link = $item->link;
$data = $item->pubDate;
$tweet = str_replace($nome.': ','',$item->description);
?>
<div id="tweet<?=$conta;?>">
<a target="_blank" href="http://twitter.com/<?=$username;?>"><img src="http://api.twitter.com/1/users/profile_image/<?=$username;?>" border="0" style="float:left; padding:3px;" width="48" height="48" title="@<?=$username;?>" /></a><a title="@<?=$username;?>" target="_blank" href="http://twitter.com/<?=$username;?>"><b><?=$nome;?></b></a>: <?=$tweet;?>
<br>
<small><span><a href="<?=$link;?>" target="_blank" style="color:#444444; text-decoration:none;"><?=$data;?></a></span></small>
</div>
<div style="clear:both;"></div>
<?php
endforeach;
?>
</body>
</html>

The above script should return something like:

exibindo tweets php

The result, with all certainty, is organic, without formatting. Therefore, It's up to you to develop the methods of style programmer and create your customized page. An example of this you can see here. Observe o chat que works no lado esquerdo da página.

Good luck! :)

In Ivaiporã-PR, Computer engineer, Workgroup Administrator Tips in General. Passionate about technology and Informatics.



Leave your comment

A bit about us

    The Group generally appeared in Tips 2007 from innovative ideas on troubleshooting problems faced daily by those who use the technology and computer science, both ordinary users and technicians. But where did, why and what is the purpose of this site?

Click here to read!

Siga o Dicas em Geral no Google+

Video of the week