11
08月
2015
29. 转发数量
使用这个 PHP 片段可以检测你的页面 URL 有多少转发数量
|
1
2
3
4
5
6
7
8
9
10
|
function tweetCount($url) {
$content = file_get_contents("http://api.tweetmeme.com/url_info?url=".$url);
$element = new SimpleXmlElement($content);
$retweets = $element->story->url_count;
if($retweets){
return $retweets;
} else {
return 0;
}
}
|
语法:
|
1
2
3
4
5
|
<?php
$url = "http://blog.koonk.com";
$count = tweetCount($url);
return $count;
?>
|
|
|
|
特殊说明,本文版权归 ning个人博客 所有带原创标签请勿转载,转载请注明出处.