php - 如何从 pinterest 获取所有图钉?仅获得 50 个引脚

标签 php api pinterest

使用此代码我一次只能获得前 50 个图钉

https://api.pinterest.com/v3/pidgets/users/lorihiney/pins/

有什么方法可以获取特定用户的所有图钉。

最佳答案

我在尝试使用 API 时也遇到了这个问题,这让我抓狂!!

我最终使用我在网上找到的信息创建了一个递归函数来获取板的所有子页面,同时还将引脚推送到一个数组。

我首先将所有电路板保存到一个 MYSQL 表中,然后将引脚保存到另一个表中。节省 API 调用并使查找重复项变得更加容易(这就是我尝试使用它的目的)!

$pins=array();

function findchildren(&$array, $i){
 global $pins;

 if (true == $i){return;}

    foreach($array as $k=>$v){
     array_push($pins, $v['data']);
       if(!empty($v['page']['next'])){
       $newar = curlfunction($v['page']['next']);
       findchildren($newar, false);
       }
    }
 }

所以像这样:

$board = curlfunction('https://api.pinterest.com/v1/boards/lorihiney/diet/pins/?access_token=xxxxx&limit=100&fields=id,link,counts,note,url,image');
findchildren($board, false);

您只需要创建 cURL 函数来获取数据!!

我的 Pinterest 帐户有 31 个图板和 1890 个图钉。在花了 AGES 试图弄明白之后,这对我来说是一种享受。希望能有所帮助。

关于php - 如何从 pinterest 获取所有图钉?仅获得 50 个引脚,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34036838/

相关文章:

php - 使用 PHP PDO 创建数据库时出现问题

php exec() 适用于某些调用,不适用于其他类似的调用

php - mysql INSERT INTO循环不插入一些行

android - android API 22 的渲染问题

python - Kubernetes Python API 客户端 : execute full yaml file

image - AddThis Pinterest 小部件提供我不想提供的图像,例如导航按钮、广告。

php - 自分配证书上的 CodeIgniter-cURL

python 请求 - 使用 'idna' 编解码器编码失败(UnicodeError : label empty or too long) error

ios - 无法快速注销 pinterest

javascript - flex 元素是否有可能与它们上方的元素紧密对齐?