我对instagram分页有问题。我需要媒体/喜欢的代码。 我已尝试使用$ jsonurl =“https://api.instagram.com/v1/useers/self/media/liked?access_token=”。$ data-> access_token。“'& count = 2”但不返回任何内容。 Thx提前!
<?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>
答案 0 :(得分:0)
网址中存在拼写错误:/useers/
需要/users/
$jsonurl = "https://api.instagram.com/v1/useers/self/media/liked?access_token='".$data->access_token."'&count=2";
需要:
$jsonurl = "https://api.instagram.com/v1/users/self/media/liked?access_token='".$data->access_token."'&count=2";