Last active
December 14, 2015 20:48
-
-
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/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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