PHP5Twitter插件

PHP5Twitter插件,php,curl,twitter,Php,Curl,Twitter,我正在尝试实现一个Twitter代码,该代码可以获取我帐户的最新帖子。尝试此操作时,我会收到错误消息 “此方法需要GET./statuses/friends\u timeline.xml?count=5” 我是新来的php旋度,我也试图搜索这个相同的错误,以获得任何线索,但无法得到任何令人满意的答案。 我已经实现了以下代码 ** Papermashup.com |推特API .推特粉丝{ 浮动:左; 右边距:20px; 边缘底部:0px; } 身体{ 字体系列:Verdana,日内瓦,无衬线;

我正在尝试实现一个Twitter代码,该代码可以获取我帐户的最新帖子。尝试此操作时,我会收到错误消息

此方法需要GET./statuses/friends\u timeline.xml?count=5” 我是新来的php旋度,我也试图搜索这个相同的错误,以获得任何线索,但无法得到任何令人满意的答案。 我已经实现了以下代码

**


Papermashup.com |推特API
.推特粉丝{
浮动:左;
右边距:20px;
边缘底部:0px;
}
身体{
字体系列:Verdana,日内瓦,无衬线;
字体大小:14px;}
.用户{
背景色:#EFEF;
边缘底部:10px;
边框底部:;
填充:10px;}
.姓名{
字体大小:14px;
字号:700;
}
2) {
echo.“$latesttweets.”我关注的用户的最新tweets |”;
}
//回显数据
foreach($tweers->状态为$twit1){
//这将在$description中查找任何链接
$description=$twit1->text;

$description=preg#u replace(“#(^|[\n])@([^\”\t\n\r这已过时。请使用另一个twitter插件的更新版本。twitter阻止了这种登录twitter的方式

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Papermashup.com | Twitter API</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<style>

.twitter_followers{
float:left;
margin-right:20px;
margin-bottom:0px;
}

body{
font-family:Verdana, Geneva, sans-serif;
font-size:14px;}

.user{
background-color:#efefef;
margin-bottom:10px;
border-bottom:;
padding:10px;}

.name{
font-size:14px;
font-weight:700;
}

</style>

</head>

<body>


<div id="header"><a href="http://www.papermashup.com/"><img src="images/logo.png" width="348" height="63" border="0" /></a></div>
<div id="container">


<?php


$login = "username:password";

$tweets = "http://twitter.com/statuses/friends_timeline.xml?count=5";
$proxy = "192.168.1.51:8080";
$tw = curl_init($tweets);
//curl_setopt ($tw, CURLOPT_PROXY, $proxy); 
//curl_setopt($tw, CURLOPT_URL, $tweets);
curl_setopt($tw, CURLOPT_USERPWD, $login);
curl_setopt($tw, CURLOPT_POSTFIELDS, '');
curl_setopt($tw, CURLOPT_RETURNTRANSFER, TRUE);
$twi = curl_exec($tw);
echo $twi;exit;
$tweeters = new SimpleXMLElement($twi);
$latesttweets = count($tweeters);

if ($latesttweets>2) {

 echo "<h3>".$latesttweets." latest tweets from the users I follow | <a href=\"http://www.twitter.com/ashleyford\">Follow Me!</a></h3>";

 }

//echo the data

foreach ($tweeters->status as $twit1) {


//This finds any links in $description
$description = $twit1->text;

$description = preg_replace("#(^|[\n ])@([^ \"\t\n\r<]*)#ise", "'\\1<a href=\"http://www.twitter.com/\\2\" >@\\2</a>'", $description);  
$description = preg_replace("#(^|[\n ])([\w]+?://[\w]+[^ \"\n\r\t<]*)#ise", "'\\1<a href=\"\\2\" >\\2</a>'", $description);
$description = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r<]*)#ise", "'\\1<a href=\"http://\\2\" >\\2</a>'", $description);

echo "<div class='user'><a href=\"http://www.twitter.com/", $twit1->user->screen_name,"\" target=\"_blank\"><img border=\"0\" class=\"twitter_followers\" src=\"", $twit1->user->profile_image_url, "\" title=\"", $twit1->name, "\" /></a>\n";
echo "<div class='name'>", $twit1->user->name,"</div>";
echo "<div class='followers'>", $twit1->user->location,"</div>";
echo "<div class='location'>", $twit1->user->url,"</div>";
echo "<div class='text'>".$description." <div class='description'>From ", $twit1->source,"</div></div></div>";}

curl_close($tw);


?>
</div>
<div id="footer"><a href="http://www.papermashup.com">papermashup.com</a> | <a href="http://papermashup.com/using-the-twitter-api/">Back to tutorial</a></div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-7025232-1");
pageTracker._trackPageview();
} catch(err) {}</script>

</body>
</html>