我正在尝试使用drupal 7 REST 服务器创建一个带有图像的节点,我已经正确配置了 REST 服务器,我能够创建以简单文本为主体的节点,我也希望能够发布图像,即我应该能够显示新创建的节点中的图像或至少应该能够将图像附加到节点主体?到目前为止,我正在这样做,如何在节点的正文中附加/显示图像?我正在通过外部 PHP 脚本执行此操作
$node_data = array(
'title' => "this is test node",
'type' => 'blog',
'body[und][0][value]' => 'this is test node description'
);
$node_data = http_build_query($node_data);
$cookie_session = $logged_user->session_name . '=' . $logged_user->sessid;
// cURL
$curl = curl_init($request_url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: application/json')); // Accept JSON response
curl_setopt($curl, CURLOPT_POST, 1); // Do a regular HTTP POST
curl_setopt($curl, CURLOPT_POSTFIELDS, $node_data); // Set POST data
curl_setopt($curl, CURLOPT_HEADER, FALSE); // Ask to not return Header
curl_setopt($curl, CURLOPT_COOKIE, "$cookie_session"); // use the previously saved session
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_FAILONERROR, TRUE);
$response = curl_exec($curl);
$http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);