You are here

protected function SimpleFbConnectFbFactory::getHttpClient in Simple FB Connect 8.3

Returns HTTP client to be used with Facebook SDK.

Facebook SDK v5 uses the following autodetect logic for determining the HTTP client: 1. If cURL extension is loaded, use it. 2. If cURL was not loaded but Guzzle is found, use it. 3. Fallback to FacebookStreamHttpClient.

Drupal 8 ships with Guzzle v6 but Facebook SDK v5 works only with Guzzle v5. Therefore we need to change the autodetect logic so that we're first using cURL and if that is not available, we fallback directly to FacebookStreamHttpClient.

Return value

string Client that should be used with Facebook SDK.

1 call to SimpleFbConnectFbFactory::getHttpClient()
SimpleFbConnectFbFactory::getFbService in src/SimpleFbConnectFbFactory.php
Returns an instance of Facebook\Facebook service.

File

src/SimpleFbConnectFbFactory.php, line 149

Class

SimpleFbConnectFbFactory
Class SimpleFbConnectFbFactory.

Namespace

Drupal\simple_fb_connect

Code

protected function getHttpClient() {
  if (extension_loaded('curl')) {
    return 'curl';
  }
  return 'stream';
}