Pinterest的关注显示 [英] Pinterest Followers display

查看:564
本文介绍了Pinterest的关注显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么会去显示在Word preSS我Pinterest的追随者?我试着但只显示按钮,让用户按照自己的帐户,一无所知我的追随者。

How would I go about showing my Pinterest followers in Wordpress? I tried this but it only displays the button letting users to follow my account, nothing about my followers.

presumably,我可以做到这一点使用Pinterest的API,但我不能确定从哪里开始。

Presumably, I can do this using the Pinterest API, but I'm unsure where to start.

任何帮助将是AP preciated。

Any help would be appreciated.

推荐答案

是的,你可以使用Pinterest的API。安装卷曲和使用,在PHP脚本。例如:

Yes, you can use the Pinterest API. Install curl and use that in a PHP script. Example:

$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, 'http://pinterestapi.co.uk/"""yourname"""/likes');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 0);
$json = curl_exec($ch);
curl_close($ch);

这应该返回像这样指出,,提供yourname是你的Pinterest的帐户名:

It's supposed to return something like this note that """yourname""" is your Pinterest account name:

{
"body": [
{
"href": "http://pinterest.com/pin/150026231307331200/",
"src": "http://media-cache-ec3.pinterest.com/upload/228979962274567868_qVshovBS_b.jpg",
"desc": "#london",
"user": "Louise Earl",
"via": "Kris Mitchell",
"board": "Ideal"
},
{
"href": "http://pinterest.com/pin/287104544965407998/",
"src": "http://media-cache-ec8.pinterest.com/upload/287104544965407998_z3kbynbX_b.jpg",
"desc": "hipsters vs old people",
"user": "Lucy Foulkes",
"via": false,
"board": "cool"
}
],
"meta": {
"count": 2
}
}

由于这会返回一个JSON字符串您需要同时取消code吧。

Since this returns a json string you´ll need to decode it.

$count = json_decode($json, true);
$count = $count['meta']['count'];

我不知道主办字preSS您的网站时,但可能是值得一试的卷曲是可用的。你的情况在该字符串计数可能是你想要的东西。

I don't know if curl is available when hosting your site on Wordpress but might be worth a try. In your case the "count" in that string is probably what you want.

这篇关于Pinterest的关注显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆