protected function _oauth2TokenNoCurl()
  {
    if (self::$_consumer_key == null) {
      throw new CodebirdCredentialsException('To obtain a bearer token, the consumer key must be set.');
    }

    $url      = self::$_endpoints['oauth'] . 'oauth2/token';
    $hostname = parse_url($url, PHP_URL_HOST);

    if ($hostname === false) {
      throw new CodebirdEndpointException('Incorrect API endpoint host.');
    }

    $contextOptions = [
      'http' => [
        'method'           => 'POST',
        'protocol_version' => '1.1',
        'header'           => "Accept: */*\r\n"
          . 'Authorization: Basic '
          . base64_encode(
            self::$_consumer_key
            . ':'
            . self::$_consumer_secret
          ),
        'timeout'          => $this->_timeouts['request'] / 1000,
        'content'          => 'grant_type=client_credentials',
        'ignore_errors'    => true
      ]
    ];
    list($reply, $headers) = $this->_getNoCurlInitialization($url, $contextOptions, $hostname);
    $result  = '';
    foreach ($headers as $header) {
      $result .= $header . "\r\n";
    }
    $result .= "\r\n" . $reply;

    // find HTTP status
    $httpstatus = $this->_getHttpStatusFromHeaders($headers);
    $reply      = $this->_parseBearerReply($result, $httpstatus);
    return $reply;
  }