Last active
December 15, 2015 09:19
-
-
Save Zenger/5237784 to your computer and use it in GitHub Desktop.
WordPress XML-RPC example.
This file contains hidden or 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 | |
//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