2011-09-20 30 views
1

我添加了自定义的Google+和Facebook按钮,并通过MY ajax更新了计数器...如何测试Google+和Facebook按钮?

这里是代码(我也包含在twitter计数器中,所以它可以用于其他人,但它的计数器确实可行):

$url = "URL OF PAGE"; 

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, "https://clients6.google.com/rpc?key=AIzaSyCKSbrvQasunBoV16zDH9R33D88CeLr9gQ"); 
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_POSTFIELDS, '[{"method":"pos.plusones.get","id":"p","params":{"nolog":true,"id":"' . $url . '","source":"widget","userId":"@viewer","groupId":"@self"},"jsonrpc":"2.0","key":"p","apiVersion":"v1"}]'); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json')); 
$curl_results = curl_exec ($ch); 
curl_close ($ch); 
$parsed_results = json_decode($curl_results, true); 
echo $parsed_results[0]['result']['metadata']['globalCounts']['count']; //Google+ counter for this URL 



$fbresponse = file_get_contents('http://graph.facebook.com/' .$url); 
$fbresponse_c = json_decode($fbresponse,true); 
if ($fbresponse_c['shares']) { echo $fbresponse_c['shares']; } else { echo '0'; } //Facebook counter for this URL 

$twresponse = file_get_contents('http://cdn.api.twitter.com/1/urls/count.json?url=' .$url. '&callback=twttr.receiveCount'); 
$twresponse = str_replace('twttr.receiveCount(' ,'', $twresponse); 
$twresponse = str_replace(')' ,'', $twresponse); 
$twresponse_c = json_decode($twresponse,true); 
echo $twresponse_c['count']; //Twitter counter for this URL 

我改变的URL“http://www.google.com”,它显示了所有网站计数器3点...

我在我的Facebook墙上分享链接,用我的弹出窗口(代码如下)但计数器没有更新(它没有更新两天)... 对于Google+我不喜欢没有帐户,所以我无法测试它...

有人可以告诉我如何测试这些? 因为从我看到它不工作...

分享我弹出这个网址对于Facebook:

"http://www.facebook.com/sharer.php?u=" + escape(url) + "&t=Some text" 

和这一个谷歌:

"https://plusone.google.com/u/0/+1/profile/?type=po&source=p&parent=https%3A%2F%2Fplusone.google.com&hl=en_US&ru=" + escape(urll) 

多久的Facebook更新它的计数器? 我该如何检查这个Google+柜台是否正常工作?

谢谢!现在

回答

0

一切都在更新中... Facebook的瞬间,我打开Goog​​le+帐户,所以我测试了太多,它也在努力......

-Closed-