title: Facebook php script doesn't work online
body: <p>I have a FB script and it works fine locally but it doens't online.
  The first script is een script for the events and the second one is to get de Facebook albums.</p>
  
  <pre><code>&lt;?php
          $fb_page_id = "408403535882715";
          $access_token = "Acces_token";
  
          $year_range = 10;
  
          $since_date = date('Y-01-01', strtotime('-' . $year_range . ' years'));
          $until_date = date('Y-01-01', strtotime('+' . $year_range . ' years'));
  
          // unix timestamp years
          $since_unix_timestamp = strtotime(date("Y-m-d"));
          $until_unix_timestamp = strtotime($until_date);
  
          $fields="id,name,description,location,venue,timezone,start_time,cover";
  
          $json_link = "https://graph.facebook.com/{$fb_page_id}/events/feed/?fields={$fields}&amp;access_token={$access_token}&amp;since={$since_unix_timestamp}&amp;until={$until_unix_timestamp}";
  
          $json = file_get_contents($json_link);
  
          $obj = json_decode($json, true, 512, JSON_BIGINT_AS_STRING);
  
          // count the number of events
          $event_count = count($obj['data']);
  
          for($x=0; $x&lt;$event_count; $x++){
              if($x&lt;1) {
                  $start_date = date( 'l, F d, Y', strtotime($obj['data'][$x]['start_time']));
  
                  $start_time = date('H:i', strtotime($obj['data'][$x]['start_time']) - 60 * 60 * 23);
  
                  $pic_big = isset($obj['data'][$x]['cover']['source']) ? $obj['data'][$x]['cover']['source'] : "https://graph.facebook.com/{$fb_page_id}/picture?type=large";
  
                  $eid = $obj['data'][$x]['id'];
                  $name = $obj['data'][$x]['name'];
                  $location = isset($obj['data'][$x]['location']) ? $obj['data'][$x]['location'] : "";
                  $description = isset($obj['data'][$x]['description']) ? $obj['data'][$x]['description'] : "";
  
                  echo "&lt;div class='eventFrontpage'";
                      echo "&lt;div class='info'&gt;";
                          echo "&lt;h1&gt;{$name}&lt;/h1&gt;";
  
                          echo "&lt;span class='datum'&gt;{$start_date} om {$start_time} uur&lt;/span&gt;&lt;/br&gt;";
  
                          echo "&lt;span class='locatie'&gt;Locatie: {$location}&lt;/span&gt;&lt;/br&gt;";
  
                          echo "&lt;span class='content'&gt;Info: {$description}&lt;/span&gt;&lt;/br&gt;";
  
                      echo "&lt;/div&gt;";
                  echo "&lt;/div&gt;";
                  break;
              }
          }
          ?&gt;
  </code></pre>
  
  <p>and this one (on different pages)</p>
  
  <pre><code>&lt;?php
          $fb_page_id = "408403535882715";
  
          $json_link = "http://graph.facebook.com/{$fb_page_id}/albums?fields=id,name,description,link,cover_photo,count";
          $json = file_get_contents($json_link);
  
          $obj = json_decode($json, true, 512, JSON_BIGINT_AS_STRING);
  
          $album_count = count($obj['data']);
  
          for($x=0; $x&lt;$album_count; $x++){
  
              $id = $obj['data'][$x]['id'];
              $name = $obj['data'][$x]['name'];
              $description = $obj['data'][$x]['description'];
              $link = $obj['data'][$x]['link'];
              $cover_photo = $obj['data'][$x]['cover_photo'];
              $count = $obj['data'][$x]['count'];
  
              // if you want to exclude an album, just add the name on the if statement
              if(
                  $name!="Profile Pictures" &amp;&amp;
                  $name!="Cover Photos" &amp;&amp;
                  $name!="Timeline Photos" &amp;&amp;
                  $name!="Mobile Uploads"
              ){
  
                  $show_pictures_link = "photos.php?album_id={$id}&amp;album_name={$name}";
  
                  echo "&lt;a class='mediaAlbum {$name}' href='{$link}' target='_blank'&gt;";
                      echo "&lt;img class='img-responsive' src='http://graph.facebook.com/{$cover_photo}/picture' alt=''&gt;";
                      echo "&lt;h2&gt;{$name}&lt;/h2&gt;";
                  echo "&lt;/a&gt;";
              }
          }
          ?&gt;
  </code></pre>
  
  <p>Someone an idea?</p>