You can use the wp_insert_post
function
$my_post = array(
'post_title' => 'Some titles',
'post_content' => 'This is my post content',
'post_status' => 'publish',
'post_author' => 1,
'post_category' => array(1, 2, 9000)
);
// Insert the post into the database
wp_insert_post( $my_post );
}