APIXmlrpc::returnResponse PHP Method

returnResponse() protected method

Generic function to send a message and an http code to client
protected returnResponse ( mixed $response, integer $httpcode = 200, array $aditionnalheaders = [] )
$response mixed string message or array of data to send
$httpcode integer http code (see : https://en.wikipedia.org/wiki/List_of_HTTP_status_codes)
$aditionnalheaders array headers to send with http response (must be an array(key => value))
    protected function returnResponse($response, $httpcode = 200, $aditionnalheaders = array())
    {
        if (empty($httpcode)) {
            $httpcode = 200;
        }
        foreach ($aditionnalheaders as $key => $value) {
            header("{$key}: {$value}");
        }
        http_response_code($httpcode);
        self::header($this->debug);
        $response = $this->escapekeys($response);
        $out = xmlrpc_encode_request(NULL, $response, array('encoding' => 'UTF-8', 'escaping' => 'markup'));
        echo $out;
        exit;
    }