Php 5 Twitter eklentisi

0 Cevap php

Ben hata mesajı belirterek olsun bu çalışılıyor., Bana hesabın son mesajı alabilir Twitter kodu uygulamak için çalışıyorum

"This method requires a GET. /statuses/friends_timeline.xml?count=5 " i am new to php Curl also i tried to search this same error to get any clues but was unable to get any satisfactory answer. I have implemented the following code.

**

<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>

**

0 Cevap