0

Here is what I have:

function xmlrpc_login($args){
    //this code actually runs
    var_dump($args); // is NULL
    ...other logic that needs the args values...
}

function xmlrpc_add_methods($methods){
    $methods['my.login'] = 'xmlrpc_login';
    return $methods;
}
add_filter('xmlrpc_methods', 'xmlrpc_add_methods');

My test request looks like this:

$request = xmlrpc_encode_request('my.login', array('username', 'password'));

$context = stream_context_create(array('http' => array(
    'method' => "POST",
    'header' => "Content-Type: text/xml",
    'content' => $request
)));
$file = file_get_contents("http://site.com/xmlrpc.php", false, $context);
$response = xmlrpc_decode($file);

var_dump($response);

The simple question is why does $args not contain any values? How do I retrieve the values?

  • You are missing a ) in the xmlrpc_encode_request call. – Tomás Cot Sep 13 '14 at 0:35
  • @TomásCot Sorry that was a bad copy paste to here. I updated the answer to reflect that ) is in my code. – Shawn Sep 15 '14 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.