Skip to content

Instantly share code, notes, and snippets.

@Zenger
Last active December 15, 2015 09:19
Show Gist options
  • Save Zenger/5237784 to your computer and use it in GitHub Desktop.
Save Zenger/5237784 to your computer and use it in GitHub Desktop.
WordPress XML-RPC example.
<?php
//https://raw.github.com/dongsheng/cURL/master/curl.class.php
require_once('curl_class.php');
$request = array(
'blog_id' => 1,
'username' => 'username',
'password' => 'password',
'post_id' => 84
);
/* oop curl instance */
$curl = new curl;
/* encode the xmlrpc request */
$encoded_request = xmlrpc_encode_request('wp.getPosts', $request );
/* get the response from the server (POST) */
$response = $curl->post('http://yoursite.com/xmlrpc.php', $encoded_request );
/* Print the response */
print_r( xmlrpc_decode($response ) );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment