text: Q:
  
  Wordpress wp_insert_post(); to different installations in one Script
  
  Imagine i have a big set of preformatted data and want to create wordpress posts out of it.
  What i need is just some little snippet how to:
  
  check if there is a wordpress connection (weather wp-blog-header.php is included or not)
  close wordpress database connection
  include("wp-blog-header");
  insert post
  
  i would do like so... is this a way i can go?
  $data = array(
                      "path/to/wordpress-instance/wp-blog-header.php" => array(
                          "post_title" => "bla",
                          "post_content" => "blubb"
                          ...
                      ),
                      "path/to/wordpress-instance/wp-blog-header.php" => array(
                          "post_title" => "bla",
                          "post_content" => "blubb"
                              ...
                      ),
                      "path/to/wordpress-instance/wp-blog-header.php" => array(
                          "post_title" => "bla",
                          "post_content" => "blubb"
                              ...
                      )
                  );
  
                  foreach($data as $path => $dataItem){
  
                      if($wpdb){
                          @mysql_close( $wpdb->dbh );//close connection
                      }
  
                      include($path);//new wp-blog-header
  
                      wp_insert_post($dataItem);
  
                  }
  
  A:
  
  that sounds like a roundabout way of doing things.  why bother shutting down the db connection in the first place?  
  instead, just create a page in wp.  then create a page template that runs php code for that page.  
  instead of printing any data from the database for that page, just loop through and print whatever data you want.  (so you don't need any sort of wp_query loop).
  if you want to pass parameters to determine which page to show, you can setup your urls like:
  http://example.com/the_page/some_parameter
  
  then use php to parse the url, get the parameter and display the correct page.
  
  