次の JSON フィードを使用して、アルバムから最新の 20 枚の写真を取得しようとしています: (リンク)
私のコードは現在動作していますが、唯一の問題はアルバムの最新の写真ではないということです:
<?php
$pic_url = "https://graph.facebook.com/10151316456544622/photos?fields=picture,name,source,created_time&limit=20"; //change limit to allow more items
$pictures = json_decode(file_get_contents($pic_url));
$countpic= sizeof ($pictures->data); // get the number of pics for later use
for($p=0; $p<$countpic; $p++):
$thumb_url = "https://graph.facebook.com/".$pictures->data[$p]->id."/picture";
$thumb = $pictures->data[$p]->source;
?>
<li>
<a href="<?php echo $thumb_url; ?>" class="fresco hover" data-fresco-group="facebook" data-fresco-caption="<?php echo $pictures->data[$p]->name; ?>">
<div><div class="hover"></div><img style="width: 225px; height:250px;" title="<?php echo $pictures->data[$p]->name; ?>" alt="<?php echo $pictures->data[$p]->name; ?>" src="<?php echo $thumb_url; ?>"></div>
</a>
</li>
<?php endfor; ?>