diff --git a/components/admin/settings.php b/components/admin/settings.php
index c10c149..93f7abf 100644
--- a/components/admin/settings.php
+++ b/components/admin/settings.php
@@ -77,6 +77,7 @@ public function admin_menu() {
*/
public function register_settings() {
register_setting( 'fbfpi_options', 'fbfpi_fanpage_id' );
+ register_setting( 'fbfpi_options', 'fbapp_accesstoken' );
register_setting( 'fbfpi_options', 'fbfpi_fanpage_stream_language' );
register_setting( 'fbfpi_options', 'fbfpi_import_interval' );
register_setting( 'fbfpi_options', 'fbfpi_import_num' );
@@ -106,6 +107,7 @@ public function admin_page() {
do_settings_sections( 'fbfpi_options' );
$fanpage_id = get_option( 'fbfpi_fanpage_id' );
+ $fbapp_accesstoken = get_option( 'fbapp_accesstoken' );
$fanpage_stream_language = get_option( 'fbfpi_fanpage_stream_language' );
$import_interval = get_option( 'fbfpi_import_interval' );
$import_num = get_option( 'fbfpi_import_num' );
@@ -133,6 +135,17 @@ public function admin_page() {
echo '';
echo '';
+
+ /**
+ * fbapp_accesstoken
+ */
+ echo '
';
+
/**
* Select stream languages
*/
diff --git a/components/import/facebook.php b/components/import/facebook.php
index 36f75ba..d881de0 100644
--- a/components/import/facebook.php
+++ b/components/import/facebook.php
@@ -56,7 +56,7 @@ class FacebookFanpageConnect {
* @since 1.0.0
*/
function __construct( $page_id, $access_token = '', $locale = 'en_EN' ) {
- $this->access_token = '1412978082344911|a7f5722a2b02f24aad0cda61ae5c4fe9';
+ $this->access_token = get_option( 'fbapp_accesstoken' );
$this->graph_url = 'https://graph.facebook.com/v2.7/';
$this->locale = $locale;
@@ -117,8 +117,20 @@ private function fetch_data( $url ) {
curl_setopt( $con, CURLOPT_SSL_VERIFYPEER, false );
$data = curl_exec( $con );
-
+
+ $responseCode = curl_getinfo($con, CURLINFO_HTTP_CODE);
curl_close( $con );
+
+
+ if ($responseCode >= 400) {
+ echo "\n
HTTP Error: " . $responseCode;
+ echo "\n
Result-Body: ";
+ print_r($data);
+ echo "\n
\n
";
+ }
+
+
+
} elseif ( ini_get( 'allow_url_fopen' ) === true || ini_get( 'allow_url_fopen' ) == 1 ) {
$data = @file_get_contents( $url );
} else {