Help inserting post into wordpress with wp_insert_post

I’m kinda stuck, I have a xml feed and need to insert part of each line into wordpress as a post. This would have been an easy job hadn’t it been for the fact that wp_posts don’t longer have a category type and my mysql skills are rather limited. Tried to fix it using wp_insert_post but didn’t really understand it.

This is about as far as I’ve come:


$con = mysql_connect("localhost","user","pass");
if (!$con)
  die('Could not connect: ' . mysql_error());

mysql_select_db("db", $con);

$xml = simplexml_load_file("q.xml");

foreach ($xml->Auctions->Auction as $a) {
    $title = $a->Title;
     $link =  $a->Link;

mysql_query("INSERT INTO bil_posts 
(post_content, post_title) VALUES('$link', '$title' ) ") 
or die(mysql_error());  


Now, this inserts the posts, but no category i chosen. I do believe this would be easier with wp_insert_post, but need help. Anyone? :slight_smile: