告诉无论鸣叫是转推或不? [英] Telling Whether A Tweet Is A Retweet Or Not?
问题描述
我使用Twitter的API,以便从特定用户的tweet拉。我有它的确切工作,我想,除了能告诉具体的鸣叫是否是从用户原件或如果它是一个转推。
I'm using the Twitter API in order to pull tweets from specific users. I have it working exactly as I want, except for being able to tell whether or not a specific tweet is original from the user or if it is a retweet.
我用下面的调用:
<$c$c>https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=philiprucker&count=1$c$c>
当在结果看,看来我应该能够从结果拉转推
,它应该返回true或false。然而,这只是返回字符串转推
。
When looking at the results, it appears that I should be able to pull retweeted
from the results and it should return true or false. However, this is only returning the string retweet
.
$url = "http://api.twitter.com/1/statuses/user_timeline.xml?include_entities=true&include_rts=true&screen_name=$screen_name&count=200" ;
$ch = curl_init($url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, TRUE);
$xml = curl_exec ($ch);
curl_close ($ch);
$twelement = new SimpleXMLElement($xml);
foreach ($twelement->status as $status) {
$text = dbEscape(trim($status->text));
$time = strtotime($status->created_at);
$id = $status->id;
$num_retweets = $status->retweet_count;
$retweet = $status->retweeted;
dbQuery("INSERT INTO `twitter` (`id`,`screen_name`,`time`,`text`,`hidden`, `numRetweets`, `retweet`) VALUES ('$id','$screen_name','$time','$text','n','$num_retweets','retweet')");
// dbQuery("INSERT INTO `twitter` (`id`,`screen_name`,`time`,`text`,`hidden`) VALUES ('$id','$screen_name','$time','$text','n')");
}
这是code做什么我形容。我相信,所有相关的code是存在的。任何帮助将大大AP preciated!
This is the code doing what I describe. I believe all the relevant code is there. Any help would be greatly appreciated!
推荐答案
您是专门把字符串转推
到表中,而不是值 $转推
。
You are specifically putting the string retweet
into the table, not the value of $retweet
.
这篇关于告诉无论鸣叫是转推或不?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!