protected function _callApiNoCurl(
    $httpmethod, $method, $method_template, $params = [], $multipart = false, $app_only_auth = false
  )
  {
    list ($authorization, $url, $params, $request_headers)
      = $this->_callApiPreparations(
        $httpmethod, $method, $method_template, $params, $multipart, $app_only_auth
      );

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

    $request_headers[] = 'Authorization: ' . $authorization;
    $request_headers[] = 'Accept: */*';
    $request_headers[] = 'Connection: Close';
    if ($httpmethod !== 'GET' && ! $multipart) {
      $request_headers[]  = 'Content-Type: application/x-www-form-urlencoded';
    }

    $contextOptions = [
      'http' => [
        'method'           => $httpmethod,
        'protocol_version' => '1.1',
        'header'           => implode("\r\n", $request_headers),
        'timeout'          => $this->_timeouts['request'] / 1000,
        'content'          => in_array($httpmethod, ['POST', 'PUT']) ? $params : null,
        '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);
    list($headers, $reply) = $this->_parseApiHeaders($result);
    // TON API & redirects
    $reply                 = $this->_parseApiReplyPrefillHeaders($headers, $reply);
    $reply                 = $this->_parseApiReply($reply);
    $rate                  = $this->_getRateLimitInfo($headers);

    $reply = $this->_appendHttpStatusAndRate($reply, $httpstatus, $rate);
    return $reply;
  }
protected function _callApiNoCurl(
    $httpmethod, $method, $method_template, $params = [], $multipart = false, $app_only_auth = false
  )
  {
    list ($authorization, $url, $params, $request_headers)
      = $this->_callApiPreparations(
        $httpmethod, $method, $method_template, $params, $multipart, $app_only_auth
      );

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

    $request_headers[] = 'Authorization: ' . $authorization;
    $request_headers[] = 'Accept: */*';
    $request_headers[] = 'Connection: Close';
    if ($httpmethod !== 'GET' && ! $multipart) {
      $request_headers[]  = 'Content-Type: application/x-www-form-urlencoded';
    }

    $contextOptions = [
      'http' => [
        'method'           => $httpmethod,
        'protocol_version' => '1.1',
        'header'           => implode("\r\n", $request_headers),
        'timeout'          => $this->_timeouts['request'] / 1000,
        'content'          => in_array($httpmethod, ['POST', 'PUT']) ? $params : null,
        '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);
    list($headers, $reply) = $this->_parseApiHeaders($result);
    // TON API & redirects
    $reply                 = $this->_parseApiReplyPrefillHeaders($headers, $reply);
    $reply                 = $this->_parseApiReply($reply);
    $rate                  = $this->_getRateLimitInfo($headers);

    $reply = $this->_appendHttpStatusAndRate($reply, $httpstatus, $rate);
    return $reply;
  }
protected function _callApiNoCurl ( $ httpmethod , $ method , $ method_template , $ params = [ ] , $ multipart = false , $ app_only_auth = false ) { list ( $ authorization , $ url , $ params , $ request_headers ) = $ this -> _callApiPreparations ( $ httpmethod , $ method , $ method_template , $ params , $ multipart , $ app_only_auth ) ; $ hostname = parse_url ( $ url , PHP_URL_HOST ) ; if ( $ hostname === false ) { throw new CodebirdEndpointException ( 'Incorrect API endpoint host.' ) ; } $ request_headers [ ] = 'Authorization: ' . $ authorization ; $ request_headers [ ] = 'Accept: */*' ; $ request_headers [ ] = 'Connection: Close' ; if ( $ httpmethod !== 'GET' && ! $ multipart ) { $ request_headers [ ] = 'Content-Type: application/x-www-form-urlencoded' ; } $ contextOptions = [ 'http' => [ 'method' => $ httpmethod , 'protocol_version' => '1.1' , 'header' => implode ( "\r\n" , $ request_headers ) , 'timeout' => $ this -> _timeouts [ 'request' ] / 1000 , 'content' => in_array ( $ httpmethod , [ 'POST' , 'PUT' ] ) ? $ params : null , '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 ) ; list ( $ headers , $ reply ) = $ this -> _parseApiHeaders ( $ result ) ; // TON API & redirects $ reply = $ this -> _parseApiReplyPrefillHeaders ( $ headers , $ reply ) ; $ reply = $ this -> _parseApiReply ( $ reply ) ; $ rate = $ this -> _getRateLimitInfo ( $ headers ) ; $ reply = $ this -> _appendHttpStatusAndRate ( $ reply , $ httpstatus , $ rate ) ; return $ reply ; }
Calls the API without cURL

@param string          $httpmethod      The HTTP method to use for making the request
@param string          $method          The API method to call
@param string          $method_template The API method template to call
@param array  optional $params          The parameters to send along
@param bool   optional $multipart       Whether to use multipart/form-data
@param bool   optional $app_only_auth   Whether to use app-only bearer authentication

@return string The API reply, encoded in the set return_format
@throws \Exception
Calls the API without cURL