getXml example

$this->error(-32600, 'server error. invalid xml-rpc. not conforming to spec. Request must be a methodCall');
        }
        $result = $this->call($this->message->methodName, $this->message->params);

        // Is the result an error?         if (is_a($result, 'IXR_Error')) {
            $this->error($result);
        }

        // Encode the result         $r = new IXR_Value($result);
        $resultxml = $r->getXml();

        // Create the XML         $xml = <<<EOD <methodResponse> <params> <param> <value> $resultxml </value> </param> </params> </methodResponse>
function _xmlrpc_wp_die_handler( $message$title = '', $args = array() ) {
    global $wp_xmlrpc_server;

    list( $message$title$parsed_args ) = _wp_die_process_input( $message$title$args );

    if ( ! headers_sent() ) {
        nocache_headers();
    }

    if ( $wp_xmlrpc_server ) {
        $error = new IXR_Error( $parsed_args['response']$message );
        $wp_xmlrpc_server->output( $error->getXml() );
    }
    if ( $parsed_args['exit'] ) {
        die();
    }
}

/** * Kills WordPress execution and displays XML response with an error message. * * This is the handler for wp_die() when processing XML requests. * * @since 5.2.0 * @access private * * @param string $message Error message. * @param string $title Optional. Error title. Default empty string. * @param string|array $args Optional. Arguments to control behavior. Default empty array. */
/** * @since 3.1.0 * @since 5.5.0 Formalized the existing `...$args` parameter by adding it * to the function signature. * * @return bool */
    public function query( ...$args ) {
        $method  = array_shift( $args );
        $request = new IXR_Request( $method$args );
        $xml     = $request->getXml();

        $port = $this->port ? ":$this->port" : '';
        $url  = $this->scheme . '://' . $this->server . $port . $this->path;
        $args = array(
            'headers'    => array( 'Content-Type' => 'text/xml' ),
            'user-agent' => $this->useragent,
            'body'       => $xml,
        );

        // Merge Custom headers ala #8145.         foreach ( $this->headers as $header => $value ) {
            

    function query( ...$args )
    {
        $method = array_shift($args);
        $request = new IXR_Request($method$args);
        $length = $request->getLength();
        $xml = $request->getXml();
        $r = "\r\n";
        $request  = "POST {$this->path} HTTP/1.0$r";

        // Merged from WP #8145 - allow custom headers         $this->headers['Host']          = $this->server;
        $this->headers['Content-Type']  = 'text/xml';
        $this->headers['User-Agent']    = $this->useragent;
        $this->headers['Content-Length']$length;

        foreach( $this->headers as $header => $value ) {
            $request .= "{$header}: {$value}{$r}";
        }
return '<int>'.$this->data.'</int>';
                break;
            case 'double':
                return '<double>'.$this->data.'</double>';
                break;
            case 'string':
                return '<string>'.htmlspecialchars($this->data).'</string>';
                break;
            case 'array':
                $return = '<array><data>'."\n";
                foreach ($this->data as $item) {
                    $return .= ' <value>'.$item->getXml()."</value>\n";
                }
                $return .= '</data></array>';
                return $return;
                break;
            case 'struct':
                $return = '<struct>'."\n";
                foreach ($this->data as $name => $value) {
                    $name = htmlspecialchars($name);
                    $return .= " <member><name>$name</name><value>";
                    $return .= $value->getXml()."</value></member>\n";
                }
                

    public function error( $error$message = false ) {
        // Accepts either an error object or an error code and message         if ( $message && ! is_object( $error ) ) {
            $error = new IXR_Error( $error$message );
        }

        if ( ! $this->is_enabled ) {
            status_header( $error->code );
        }

        $this->output( $error->getXml() );
    }

    /** * Retrieves custom fields for post. * * @since 2.5.0 * * @param int $post_id Post ID. * @return array Custom fields, if exist. */
    public function get_custom_fields( $post_id ) {
        
$this->args = $args;
        $this->xml = <<<EOD <?xml version="1.0"?> <methodCall> <methodName>{$this->method}</methodName> <params> EOD;
        foreach ($this->args as $arg) {
            $this->xml .= '<param><value>';
            $v = new IXR_Value($arg);
            $this->xml .= $v->getXml();
            $this->xml .= "</value></param>\n";
        }
        $this->xml .= '</params></methodCall>';
    }

    /** * PHP4 constructor. */
    public function IXR_Request( $method$args ) {
        self::__construct( $method$args );
    }

    
Home | Imprint | This part of the site doesn't use cookies.