drupalサイトにdrupal以外のサイトからノードを作成しようとしていますが、私の人生では動作しません。 drupalサービス以外のサイトからdrupal services node.saveを使用するにはどうすればいいですか?
この
は...$domain = 'http://mydomain.com';
$operation = 'node.save';
$api_key = 'my api key';
$timestamp = (string) time();
$nonce = substr(md5(uniqid('s', true)), 0, 10);
$hash = hash_hmac('sha256', $timestamp .';'.$domain .';'. $nonce .';'.$operation, $api_key);
$node_data = array(
'type' => 'story',
'title' => 'test story title',
'body' => 'test story text'
);
$send_data = array(
'method' => $operation,
'args' => array(
'hash' => $hash,
'domain_name' => $domain,
'domain_time_stamp' => $timestamp,
'nonce' => $nonce,
'node' => serialize($node_data)
)
);
$request = xmlrpc_encode_request($operation, $send_data);
$context = stream_context_create(
array(
'http' => array(
'method' => "POST",
'header' => "Content-Type: text/xml",
'content' => $request
)
)
);
$retrieve = file_get_contents($domain .'/services/xmlrpc', false, $context);
$response = xmlrpc_decode($retrieve);
echo '<pre>'. htmlspecialchars(print_r($response, 1)) .'</pre>';
私の周りグーグルから構築したコードですが、オールズは、私は戻って、サーバーから取得されます。「必要な引数がありません:ノード」を、そしてI'maはいまいましいことを渡しますたわごと...
私は大丈夫だと感じるようにする "system.connect"レスポンスを得ることができますが、それはすべて私が得ることができます。私のサービス設定では、session_idは必要ありません。
私はStackOverflowの助け...あなたは私の唯一の希望