Skip to content

Instantly share code, notes, and snippets.

@BFTrick
Last active December 14, 2015 20:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BFTrick/5146448 to your computer and use it in GitHub Desktop.
Save BFTrick/5146448 to your computer and use it in GitHub Desktop.
Some example code for using XML RPC. Originally from: http://jumping-duck.com/tutorial/using-xml-rpc-in-wordpress/
<?php
// include wordpress so that we have access to some of the prebuilt functionality
include_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php' );
// include helper classes
include_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-includes/class-IXR.php' );
include_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-includes/class-wp-http-ixr-client.php' );
// create new XMLRPC Client
$client = new WP_HTTP_IXR_CLIENT( 'http://www.mydomain.com/xmlrpc.php' );
// say hello!
$hello = $client->query( 'demo.sayHello', array() );
// add two numbers together
$addition = $client->query( 'demo.addTwoNumbers', array( 55, 17 ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment