<?php

// Load WordPress
require( dirname( __FILE__ ) . '/wp-load.php' );

// Set the RSS feed URL
$feed_url = "http://example.com/rss";

// Get the RSS feed content
$feed = simplexml_load_file( $feed_url );

// Loop through each feed item and create a post
foreach ( $feed->channel->item as $item ) {

    // Check if post already exists
    $existing_post = get_page_by_title( $item->title, 'OBJECT', 'post' );

    if ( $existing_post === null ) {

        // Create post object
        $new_post = array(
            'post_title'    => $item->title,
            'post_content'  => $item->description,
            'post_status'   => 'publish',
            'post_author'   => 1,
            'post_category' => array( 1 )
        );

        // Insert the post into the database
        wp_insert_post( $new_post );
    }
}
?>