Changeset 815168
- Timestamp:
- 12/05/2013 01:25:41 AM (12 years ago)
- File:
-
- 1 edited
-
facebook-albums/trunk/fbalbum.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
facebook-albums/trunk/fbalbum.php
r811689 r815168 150 150 preg_match("/[fbalbum [^>]*url=(.+) /", $post->post_content, $output); 151 151 $facebook_album_url = str_replace('"', '', $output[1]); 152 error_log($facebook_album_url);153 152 FB_Album::_set_album_url($facebook_album_url); 154 153 $album_id = FB_Album::_get_album_id(); … … 164 163 return 'Album ID was empty'; 165 164 if(!($fb = self::_get_graph_results(self::$album_limit))) 166 return 'Facebook API returned empty result. Please double check your Facebook album URL.';165 return; 167 166 //print_r($fb); 168 167 if(!$fb['photos']) … … 283 282 } catch (FacebookApiException $e) { 284 283 error_log($e); 284 print $e; 285 285 286 $album = null; 286 287 } … … 302 303 $facebook_graph_results = null; 303 304 $facebook_graph_url = $uri; //TODO: Add URL checking here, else error out 304 305 if(ini_get('allow_url_fopen')) {306 $facebook_graph_results = @file_get_contents($facebook_graph_url);307 } else {308 305 //Attempt CURL 309 306 if (extension_loaded('curl')){ 310 307 $ch = curl_init(); 311 308 curl_setopt($ch,CURLOPT_URL, $facebook_graph_url); 309 curl_setopt($ch, CURLOPT_HEADER, 0); 312 310 curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); 313 if(!$facebook_graph_results = curl_exec($ch)) 314 echo 'Curl error: ' . curl_error($ch); 311 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 312 if(!$facebook_graph_results = curl_exec($ch)) { 313 printf('<p>cURL Error: %1$s %2$s</p>', curl_errno($ch), curl_error($ch)); 314 printf('<p>Please try entering <strong>%s</strong> into your URL bar and seeing if the page loads.', $facebook_graph_url); 315 } 316 if(curl_errno($ch) == 7) { 317 print '<p><strong>Your server cannot communicate with Facebook\'s servers. This means your server does not support IPv6 or is having issues resolving facebook.com. Please contact your hosting provider.'; 318 } 315 319 curl_close($ch); 316 320 } else { 317 die('Sorry, your server does not allow remote fopen or have CURL');321 print ('Sorry, your server does not allow remote fopen or have CURL'); 318 322 } 319 }320 323 $facebook_graph_results = json_decode($facebook_graph_results, true); 321 324 return $facebook_graph_results;
Note: See TracChangeset
for help on using the changeset viewer.