diff --git a/organic-search-analytics/apis/Bing/Webmasters.php b/organic-search-analytics/apis/Bing/Webmasters.php index 6fc2501..c75f812 100644 --- a/organic-search-analytics/apis/Bing/Webmasters.php +++ b/organic-search-analytics/apis/Bing/Webmasters.php @@ -32,18 +32,22 @@ class BingWebmasters */ public function requestApi( $api_key, $method, $siteUrl = NULL ) { $url = self::URL_BING_WEBMASTERS_JSON.$method.'?apikey='.$api_key; - + if( $siteUrl ) { $url .= '&siteUrl='.$siteUrl; } $ch = curl_init(); - curl_setopt($ch,CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - - $result = curl_exec($ch); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + + if( ! $result = curl_exec($ch) ) { + $alert = array("type"=>"error", "message"=>"Error communicating with the Bing API"); + } + curl_close($ch); - + return $result; } diff --git a/organic-search-analytics/inc/code/dataCapture.php b/organic-search-analytics/inc/code/dataCapture.php index d382bd4..29a6372 100644 --- a/organic-search-analytics/inc/code/dataCapture.php +++ b/organic-search-analytics/inc/code/dataCapture.php @@ -59,9 +59,9 @@ public function getSitesGoogleSearchConsole() { * * @returns Array */ - public function getSitesBingWebmaster($enabledCheck = FALSE) { + public function getSitesBingWebmaster($enabledCheck = FALSE) { $bing = new BingWebmasters(); // Load Bing Webmasters API - + $bingSites = json_decode( $bing->requestApi( config::CREDENTIALS_BING_API_KEY, 'GetUserSites' ) ); $return = array();