2016-06-12 109 views
0

我一直在我的网站上使用这段代码作为instagram feed,并突然它不再工作了,我创建了一个新的id和accesstoken,但这些都不起作用。Instagram的照片显示

<?php 
    // Supply a user id and an access token 
    $userid = "******"; 
    $accessToken = "*******"; 

    // Gets our data 
    function fetchData($url){ 
     $ch = curl_init(); 
     curl_setopt($ch, CURLOPT_URL, $url); 
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
     curl_setopt($ch, CURLOPT_TIMEOUT, 20); 
     $result = curl_exec($ch); 
     curl_close($ch); 
     return $result; 
    } 

    // Pulls and parses data. 
    $result = fetchData("https://api.instagram.com/v1/users/{$userid} /media/recent/?access_token={$accessToken}"); 
    $result = json_decode($result); 
?> 


    <?php foreach ($result->data as $post): ?> 
    <!-- Renders images. @Options (thumbnail,low_resoulution, high_resolution) --> 
    <a class="group" rel="group1" href="<?= $post->images->standard_resolution->url ?>"><img src="<?= $post->images->thumbnail->url ?>"></a> 
<?php endforeach ?> 

回答

0

的Instagram已经更新了他们的服务条款。现在每个应用程序都需要由他们审查。