【问题标题】:Instagram pagination gow can I fix我可以修复 Instagram 分页吗
【发布时间】:2013-07-08 19:11:07
【问题描述】:

我的 Instagram 分页有问题。我需要媒体/喜欢的代码。 我试过 $jsonurl = "https://api.instagram.com/v1/useers/self/media/liked?access_token='".$data->access_token."'&count=2" 但不返回任何东西。 提前谢谢!

<?php 
session_start(); 
$data=$_SESSION['userdetails'];
echo $data->access_token;
if (isset($_REQUEST['next']) && isset($_SESSION['next'])) 
$jsonurl = $_SESSION['next']; 
else 
$jsonurl = "https://api.instagram.com/v1/useers/self/media/liked?access_token='".$data-    >access_token."'&count=2"; 
$json = file_get_contents($jsonurl,0,null,null); 
$response = json_decode($json, true); 

$_SESSION['next'] = $response['pagination']['next_url']; 
?> 
<div class="photo"> 
<a href="<?= $link ?>"><span></span><img src="<?= $thumbnail ?>" title="<?= $text ?>" alt="<?= $text ?>" /></a> 
    <div class="metaz">via <?= $author ?> at <?echo date("h:i:s A 
\o\\n d/m/Y",$date);?></div> 
    <?= $text ?>

// Button code here: 
<a href="?next">next</a> 

【问题讨论】:

    标签: php pagination call instagram


    【解决方案1】:

    您的网址中有拼写错误:/useers/ 必须是 /users/

    $jsonurl = "https://api.instagram.com/v1/useers/self/media/liked?access_token='".$data-&gt;access_token."'&amp;count=2";

    需要:

    $jsonurl = "https://api.instagram.com/v1/users/self/media/liked?access_token='".$data-&gt;access_token."'&amp;count=2";

    【讨论】:

    • 另外,- &gt; 需要附加 -&gt;
    • 是的,请忽略->和用户
    • 我将代码放入 wordpress 页面...我有另一个代码,但结果只有 20 张照片...所以我需要分页。当我在纯 php 中尝试代码时,我收到错误。警告:get_file_content .....Error 400 Bad request
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-25
    • 1970-01-01
    • 1970-01-01
    • 2014-02-06
    • 1970-01-01
    • 2021-07-23
    相关资源
    最近更新 更多