3 * XML-RPC protocol support for WordPress
9 * Whether this is an XML-RPC Request
13 define('XMLRPC_REQUEST', true);
15 // Some browser-embedded clients send cookies. We don't want them.
18 // A bug in PHP < 5.2.2 makes $HTTP_RAW_POST_DATA not set by default,
19 // but we can do it ourself.
20 if ( !isset( $HTTP_RAW_POST_DATA ) ) {
21 $HTTP_RAW_POST_DATA = file_get_contents( 'php://input' );
24 // fix for mozBlog and other cases where '<?xml' isn't on the very first line
25 if ( isset($HTTP_RAW_POST_DATA) )
26 $HTTP_RAW_POST_DATA = trim($HTTP_RAW_POST_DATA);
28 /** Include the bootstrap for setting up WordPress environment */
29 include('./wp-load.php');
31 if ( isset( $_GET['rsd'] ) ) { // http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html
32 header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
34 <?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
35 <rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
37 <engineName>WordPress</engineName>
38 <engineLink>http://wordpress.org/</engineLink>
39 <homePageLink><?php bloginfo_rss('url') ?></homePageLink>
41 <api name="WordPress" blogID="1" preferred="true" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
42 <api name="Movable Type" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
43 <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
44 <api name="Blogger" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
47 * Add additional APIs to the Really Simple Discovery (RSD) endpoint.
49 * @link http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html
53 do_action( 'xmlrpc_rsd_apis' );
62 include_once(ABSPATH . 'wp-admin/includes/admin.php');
63 include_once(ABSPATH . WPINC . '/class-IXR.php');
64 include_once(ABSPATH . WPINC . '/class-wp-xmlrpc-server.php');
67 * Posts submitted via the XML-RPC interface get that title
68 * @name post_default_title
71 $post_default_title = "";
74 * Filter the class used for handling XML-RPC requests.
78 * @param string $class The name of the XML-RPC server class.
80 $wp_xmlrpc_server_class = apply_filters( 'wp_xmlrpc_server_class', 'wp_xmlrpc_server' );
81 $wp_xmlrpc_server = new $wp_xmlrpc_server_class;
83 // Fire off the request
84 $wp_xmlrpc_server->serve_request();
89 * logIO() - Writes logging info to a file.
92 * @deprecated Use error_log()
94 * @param string $io Whether input or output
95 * @param string $msg Information describing logging reason.
97 function logIO( $io, $msg ) {
98 _deprecated_function( __FUNCTION__, '3.4', 'error_log()' );
99 if ( ! empty( $GLOBALS['xmlrpc_logging'] ) )
100 error_log( $io . ' - ' . $msg );