dsuoedtom207012191 2014-02-18 20:54
浏览 28

too long

Today I started working with the Instagram API. I got it working only with one problem.

Here is the code that I use:

    $value = file_get_contents('https://api.instagram.com/v1/users/self/feed?access_token=mytokenhere');
    $value = json_decode($value, true);
    print_r($value)

My problem is that I want to get exactly 20 results yet I only manage to get exactly 16 of them. I tried a few things:

  • The count parameter &count=20
  • Checked if all the people on my feed aren't private
  • Added a picture to Instagram, stays at 16.

I have no idea how I can fix this. When I say &count=5 it returns 4 and &count=10 gives 8..

Thanks in advance! Tips / help would be appreciated!

Edit: While reading this post through again I saw this: Count 5 returns 4 Count 10 returns 8 Count 15 returns 12 Count 20 returns 16 .. For every 5 it just leaves one out. I just tried 25 and it worked! I got returned with 20.

Still I think this is a problem! Or is this how it is supposed to work?

  • 写回答

1条回答 默认 最新

  • drake900918 2014-02-18 21:42
    关注

    Do a simple http request using your url https://api.instagram.com/v1/users/self/feed?access_token=mytokenhere&count=5 using any browser or curl on command line.

    Then examine the response visually, it should be a json payload. You can pretty-print it with for example, http://jsonprettyprint.com/.

    The big json payload should have some headers and a sub json array of data, this array should have 5 elements.

    If the http request itself has no problem, then it might be some bug in the php functions you called, file_get_contents, print_r, and json_decode, or the way you are using them might be problematic.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 51单片机中C语言怎么做到下面类似的功能的函数(相关搜索:c语言)
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起