使用php和instagram api获得500错误

时间:2015-02-26 17:51:26

标签: php instagram-api

我的开发服务器上没有出现此问题,但在我的生产服务器上,我收到错误:使用instagram api在此php页面上出现500内部服务器错误。这是我的php.ini代码中的问题吗?

页面在这里: http://newsinteractive.post-gazette.com/instagram/php/getdata.php

代码:

    <?php

  $instagram_url = 'https://api.instagram.com/v1/tags/testlaura/media/recent/?client_id=client_id';
$instagram_json = file_get_contents($instagram_url);
  $instagram_array = json_decode($instagram_json, true);
   $allourlikes = []; 

  //var_dump($instagram_array);
   if(!empty($instagram_array)){
    foreach($instagram_array['data'] as $key => $value){
       //echo $value['images']['standard_resolution']['url']; 
       foreach($value['likes']['data'] as $k => $likes){  //find out if *we* liked it
             $ourlikes = [];
            //echo $likes['username']; 
            if ($likes['username'] == 'ourusername') { 
                $ourlikes['url'] = $value['images']['standard_resolution']['url'];
                $ourlikes['caption'] = $value['caption']['text'];
                $ourlikes['link'] = $value['link'];
                $ourlikes['user'] = $value['user']['username']; 
                //array_push($ourlikes, $value['images']['standard_resolution']['url'], $value['caption']['text'], $value['link'], $value['user']['username']);
            }
            array_push($allourlikes, $ourlikes);
       }

    }


  }
  echo json_encode($allourlikes);

  ?>

0 个答案:

没有答案