protected function _getNoCurlInitialization($url, $contextOptions, $hostname = '')
  {
    $httpOptions = [];

    $httpOptions['header'] = [
      'User-Agent: codebird-php/' . $this->getVersion() . ' +https://github.com/jublonet/codebird-php'
    ];

    $httpOptions['ssl'] = [
      'verify_peer'  => true,
      'cafile'       => __DIR__ . '/cacert.pem',
      'verify_depth' => 5,
      'peer_name'    => $hostname
    ];

    if ($this->_hasProxy()) {
      $httpOptions['request_fulluri'] = true;
      $httpOptions['proxy'] = $this->_getProxyHost() . ':' . $this->_getProxyPort();

      if ($this->_getProxyAuthentication()) {
        $httpOptions['header'][] =
          'Proxy-Authorization: Basic ' . base64_encode($this->_getProxyAuthentication());
      }
    }

    // merge the http options with the context options
    $options = array_merge_recursive(
      $contextOptions,
      ['http' => $httpOptions]
    );

    // concatenate $options['http']['header']
    $options['http']['header'] = implode("\r\n", $options['http']['header']);

    // silent the file_get_contents function
    $content = @file_get_contents($url, false, stream_context_create($options));

    $headers = [];
    // API is responding
    if (isset($http_response_header)) {
      $headers = $http_response_header;
    }

    return [
      $content,
      $headers
    ];
  }
protected function _getNoCurlInitialization($url, $contextOptions, $hostname = '')
  {
    $httpOptions = [];

    $httpOptions['header'] = [
      'User-Agent: codebird-php/' . $this->getVersion() . ' +https://github.com/jublonet/codebird-php'
    ];

    $httpOptions['ssl'] = [
      'verify_peer'  => true,
      'cafile'       => __DIR__ . '/cacert.pem',
      'verify_depth' => 5,
      'peer_name'    => $hostname
    ];

    if ($this->_hasProxy()) {
      $httpOptions['request_fulluri'] = true;
      $httpOptions['proxy'] = $this->_getProxyHost() . ':' . $this->_getProxyPort();

      if ($this->_getProxyAuthentication()) {
        $httpOptions['header'][] =
          'Proxy-Authorization: Basic ' . base64_encode($this->_getProxyAuthentication());
      }
    }

    // merge the http options with the context options
    $options = array_merge_recursive(
      $contextOptions,
      ['http' => $httpOptions]
    );

    // concatenate $options['http']['header']
    $options['http']['header'] = implode("\r\n", $options['http']['header']);

    // silent the file_get_contents function
    $content = @file_get_contents($url, false, stream_context_create($options));

    $headers = [];
    // API is responding
    if (isset($http_response_header)) {
      $headers = $http_response_header;
    }

    return [
      $content,
      $headers
    ];
  }
protected function _getNoCurlInitialization ( $ url , $ contextOptions , $ hostname = '' ) { $ httpOptions = [ ] ; $ httpOptions [ 'header' ] = [ 'User-Agent: codebird-php/' . $ this -> getVersion ( ) . ' +https://github.com/jublonet/codebird-php' ] ; $ httpOptions [ 'ssl' ] = [ 'verify_peer' => true , 'cafile' => __DIR__ . '/cacert.pem' , 'verify_depth' => 5 , 'peer_name' => $ hostname ] ; if ( $ this -> _hasProxy ( ) ) { $ httpOptions [ 'request_fulluri' ] = true ; $ httpOptions [ 'proxy' ] = $ this -> _getProxyHost ( ) . ':' . $ this -> _getProxyPort ( ) ; if ( $ this -> _getProxyAuthentication ( ) ) { $ httpOptions [ 'header' ] [ ] = 'Proxy-Authorization: Basic ' . base64_encode ( $ this -> _getProxyAuthentication ( ) ) ; } } // merge the http options with the context options $ options = array_merge_recursive ( $ contextOptions , [ 'http' => $ httpOptions ] ) ; // concatenate $options['http']['header'] $ options [ 'http' ] [ 'header' ] = implode ( "\r\n" , $ options [ 'http' ] [ 'header' ] ) ; // silent the file_get_contents function $ content = @ file_get_contents ( $ url , false , stream_context_create ( $ options ) ) ; $ headers = [ ] ; // API is responding if ( isset ( $ http_response_header ) ) { $ headers = $ http_response_header ; } return [ $ content , $ headers ] ; }
Gets a non cURL initialization

@param string $url            the URL for the curl initialization
@param array  $contextOptions the options for the stream context
@param string $hostname       the hostname to verify the SSL FQDN for

@return array the read data
Gets a non cURL initialization