drupal using node.save with XMLRPC call to another site. "Access Denied" message
- by EricP
I have a piece of code on 1 drupal site to create a node another drupal site in a multi-site setup.
It looks like I'm getting the sessionid and logging in just fine, but when trying to create a "page" node, I get "Access denied". Under Services - Settings I have "Key Authentication", "Use keys" is unchecked, and "Use sessid" is checked.
Below is my code:
<p>Test Page 1</p>
<? $url = 'http://drupal2.dev/xmlrpc.php'; ?>
<?
$conn = xmlrpc($url, 'system.connect');
print_r($conn);
?>
<p>--</p>
<?
$login = xmlrpc($url, 'user.login', $conn['sessid'], 'superuser_name', 'superuser_password');
print_r($login);
?>
<p>--</p>
<?
$data=array('type'=>'page', 'title'=>'Test', 'body'=>'test');
$data_s=serialize($data);
$result = xmlrpc($url, 'node.save', $login['sessid'], $data_s);
echo $result;
//echo $data_s;
?>
<?
if($error = xmlrpc_error()){
if($error->code > 0){
$error->message = t('Outgoing HTTP request failed because the socket could not be opened.');
}
drupal_set_message(t('Operation failed because the remote site gave an error: %message (@code).',
array(
'%message' => $error->message,
'@code' => $error->code
)
)
);
}
?>
thanks for the help.