使用node_save采集内容到drupal 使用node_save存储cck字段

// Construct the new node object.
$node = new stdClass();
$node->title = "Your node title";
$node->body = "The body text of your node.";
$node->type = 'abc';
$node->created = time();
$node->changed = $node->created;
$node->status = 1;          // Published?
$node->promote = 0;       // Display on front page?
$node->sticky = 0;          // Display top of page?
$node->format = 1;         // Filtered HTML?
$node->uid = 1;             //  Content owner uid (author)?
$node->language = 'en';
/* **************
    CCK date fields
        format dates as shown in your content_type's data table
        Mine were: 2008-12-25T00:00:00
    ************** */
$today = mktime(0,0,0, date("m"),date("d"),date("Y"));
$cck_today = date("Y-m-d") . "T00:00:00";
$node->field_abc_date_joined[0]['value'] = $cck_today;
/* **************
    CCK reference fields
        $node->['field_name'][0]['uid']  = 3;
        $node->['field_name'][0]['nid']  = 125;
    ************** */
$node->field_abc_user_ref_uid[0]['uid']  = 3;
/* **************
    CCK select fields using the options widget
        $node['field_name']['key'] = 'your value';
             or if it's multiple select: $node['field_name']['keys'] = array('your value').
    ************** */
$node->field_abc_intern_status['key'] = 'trainee';
$node->field_abc_certified_value['key'] = 'no';
/* **************
    CCK regular text fields
        $node['field_name'][0]['value'] = 'your value';
    ************** */
$node->field_abc_member_status[0]['value'] = 'volunteer';
node_submit($node);
node_save($node);
<?php
$node->taxonomy = array(23); 
node_save($node); 
?>
$node->taxonomy['tags'][1] = 'Term1,Term2,Term3';
<?php
// Construct the new node object.
$node = new stdClass();
// Your script will probably pull this information from a database.
$node->title = "My imported node";
$node->body = "The body of my imported node.\n\nAdditional Information";
$node->type = 'story';   // Your specified content type
$node->created = time();
$node->changed = $node->created;
$node->status = 1;
$node->promote = 1;
$node->sticky = 0;
$node->format = 1;       // Filtered HTML
$node->uid = 1;          // UID of content owner
$node->language = 'en';
// If known, the taxonomy TID values can be added as an array.
$node->taxonomy = array(2,3,1,);
node_save($node);
?>