If you want to update the node programmatically, the following example update the node title and the value of the custom field called field_example.
// Load the node with nid = 1
$nid = 1;
$a_node = node_load($nid);
$a_node->title = 'new title';
$a_node->field_example['und'][0]['value'] = 'new value';
// Save the node
node_save($a_node);
// If you want to populate the node author and creation date, call node_submit() before saving
/*
if($a_node = node_submit($a_node)) {
// Save the node
node_save($a_node);
}
*/
Done =)
Reference: fooninja.net – Updating nodes programmatically in Drupal 7
