src/TelebotSDK/BotApi.php
protected function performMethod($method, $resultClass, $args = []) {
        $end_point = $this->api_url . '/' . $method;

        if (empty($args)) {
            $content_type = 'Content-type: application/x-www-form-urlencoded';
            $content = null;
        } else {
            $multipart_boundary = uniqid('---Telebot_FromBoundary');
            $content_type = 'Content-type: multipart/form-data'
                . '; boundary=' . $multipart_boundary;

            $content = self::renderFormDataContent($args, $multipart_boundary);
        }

        // Setting a custom stream context,
        $context = stream_context_create([
            'http' => [
                // To ignore http errors and return the response result anyway
                'ignore_errors' => true,
                'method' => 'POST',
                'header' => $content_type,
                'content' => $content,
            ],
        ]);

        // Call telegram api, and return the response
        $responseText = file_get_contents($end_point, false, $context);

        $response = JsonMapper::getInstance()->map(
            json_decode($responseText),
            Jsonable::instantiate(Response::class, [$resultClass])
        );

        return $response;
    }
protected function performMethod($method, $resultClass, $args = []) {
        $end_point = $this->api_url . '/' . $method;

        if (empty($args)) {
            $content_type = 'Content-type: application/x-www-form-urlencoded';
            $content = null;
        } else {
            $multipart_boundary = uniqid('---Telebot_FromBoundary');
            $content_type = 'Content-type: multipart/form-data'
                . '; boundary=' . $multipart_boundary;

            $content = self::renderFormDataContent($args, $multipart_boundary);
        }

        // Setting a custom stream context,
        $context = stream_context_create([
            'http' => [
                // To ignore http errors and return the response result anyway
                'ignore_errors' => true,
                'method' => 'POST',
                'header' => $content_type,
                'content' => $content,
            ],
        ]);

        // Call telegram api, and return the response
        $responseText = file_get_contents($end_point, false, $context);

        $response = JsonMapper::getInstance()->map(
            json_decode($responseText),
            Jsonable::instantiate(Response::class, [$resultClass])
        );

        return $response;
    }
@param $method
@param $resultClass
@param array $args

@return Response
@throws \JsonMapper_Exception