Instagram分页

<?php
require 'db.php';

function callInstagram($url)
{
    $ch = curl_init();
    curl_setopt_array($ch, array(
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_SSL_VERIFYHOST => 2
    ));

    //catstagram start
    $result = curl_exec($ch);
    curl_close($ch);
    return $result;
}

$tag = 'nypgraduation2014';
$client_id = "e4c623cb050444eeb7072e1a577da5b3";
$url = 'https://api.instagram.com/v1/tags/'.$tag.'/media/recent?client_id='.$client_id;


while (isset($url) && $url != '')
{
    $inst_stream = callInstagram($url);
    $results = json_decode($inst_stream, true);

    foreach($results['data'] as $item)
    {
        $image_link = $item['images']['standard_resolution']['url'];
        //$path_parts = pathinfo($image_link);
        // save the file name in variable
        //$image = ($path_parts['basename']);
        //copy($image_link,"photos/" .$image);
        mysql_query("INSERT INTO fypj131127cdb.instagramphoto(url) values('$image_link')");



        // copy the file to you folder

   }
   $url = $result['pagination']['next_url'];
   $image = "SELECT * FROM fypj131127cdb.instagramphoto ORDER BY ImageID ASC;";
   $img_result=mysql_query($image);
   $imageIndex = 0;

    ?>

Hi guys, I have trouble displaying all the instagram images with the hashtag #nypgraduation2014 using pagination. By using this codes, I don't know why I cannot display all the photos. As I am new to php and api, therefore I hope you guys can help me. Thanks!