I am trying to use WordPress XMLRPC. I found that by default XMLRPC will be enabled in my version of WordPress (3.9.1). But when I am trying to run the below PHP code an error is displayed like Fatal error: Call to undefined function xmlrpc_encode_request() in /Applications/XAMPP/xamppfiles/htdocs/easyblog/test/hellotest.php on line 6

Here is my PHP code.

<?PHP
//XML RPC Test
define('RPC_URL', 'http://localhost/wordpress/xmlrpc.php');
function sendRequest($methodName, $parameters)
{
    $request = xmlrpc_encode_request($methodName, $parameters);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
    curl_setopt($ch, CURLOPT_URL, RPC_URL);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 1);
    $results = curl_exec($ch);
    $results = xml_decode($results);
    curl_close($ch);
    return $results;
}
$parameters = array();
$response = sendRequest('demo.sayHello', $parameters);?>

Server Details
I am using XAMPP server with PHP 5.5.11 on Mac OS X.

When i Googled this error I found that we need to enable XMLRPC in xampp php configutation file. so in XAMPP php.ini file I have uncommented extension=php_xmlrpc.dll and restarted the server and checked. But again I am getting the same error.

Can any one help me in finding out the solution for this.

Read more here: Issue with WordPress XMLRPC


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, ,

Wordpress related questions and answers: