title: Facebook create an album graph api
body: <p>I have written a facebook app which checks if an album exists, if it does not it creates one.</p>
  
  <p>This was all working 2 weeks ago and now I go and check it to show the client and it is no longer working. I was thinking it could have something to do with Facebook and maybe they now require an SSL? I can't find any evidence of this on there website however.</p>
  
  <p>The error I am getting is:</p>
  
  <pre><code>Warning: file_get_contents(https://graph.facebook.com/517578134925015/albums?access_token=AAAD5tUCp808BAIZBPk4eV11mlf9C92velLsDeZAm5mXhKZCkwpM3LNy7ax6BBmhuH4BVZBUN6Iycyt55NoXZAFSts9zHeCFNzT6FLJYucgT2SQG8fOYIP) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 500 Internal Server Error in /var/www/vhosts/hidden/development/cms/backend/publishAlbum.php on line 59
  </code></pre>
  
  <p>My current code is:</p>
  
  <pre><code>                //If no album ID is set, create a new album.
              $graph_url = "https://graph.facebook.com/".$pageId."/albums?" . "access_token=". $pageAccessToken;
              $postdata = http_build_query(
                  array(
                      'name' =&gt; $albumName
                  )
              );
              $opts = array('http' =&gt;
                  array(
                      'method'=&gt; 'POST',
                      'header'=&gt;
                      'Content-type: application/x-www-form-urlencoded',
                      'content' =&gt; $postdata
                  )
              );
              $context = stream_context_create($opts);
              $result = json_decode(file_get_contents($graph_url, false, $context));
  </code></pre>
  
  <p>Any help is appreciated. </p>
  
  <p>Thanks</p>
  
  <p>EDIT:</p>
  
  <p>The code I tried that uses the API.</p>
  
  <pre><code>$params = array(
      'name' =&gt; 'testtest',
      'message' =&gt; 'test test'
  );
  try{
      $albumtResult = $facebook-&gt;api('/'.$pageId.'/albums', 'post', $params);
  }
  catch(FacebookApiException $e){
      error_log($e);
      $albumtResult = null;
  }
  $albumId = $albumtResult-&gt;id;
  </code></pre>
  
  <p>Here is the caught exception: <a href="http://pastebin.com/pxeyRTDn" rel="nofollow">http://pastebin.com/pxeyRTDn</a></p>