我是 Wistia.com 的新手,我想知道是否有办法使用 javascript/jquery 或 php 获得我的视频在 Facebook 上的点赞数?我正在使用 Wistia API。
问问题
168 次
1 回答
2
function count_fb_like($yourUrl) {
$json_string = file_get_contents_curl('http://api.facebook.com/restserver.php?method=links.getStats&format=json&urls='.$yourUrl);
$json = json_decode($json_string, true);
return isset($json[0]['total_count'])?intval($json[0]['total_count']):0;
}
function file_get_contents_curl($url){
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT,60);
$cont = curl_exec($ch);
if(curl_error($ch)){
die(curl_error($ch));
}
return $cont;
}
于 2014-08-27T04:16:09.143 回答