I'm using Scrapy to parse a website and then add these scraped informations to the wordpress blog. So after the scrapy script has parsed a website it sends all data in the json format to php script, which adds them to wordpress. The problem is that when this php script is called from Scrapy, it adds all data correctly EXCEPT assigning the post to the category. Somehow this doesn't work, although it adds the scraped categories to wordpress. It also doesn't automatically insert admin as a post author. There are just two blank fields(in author and categories columns).
What's interesting the php script adds all field correctly when it's run directly(not as a call from Scrapy script). All data are correctly sended to php script. You can see that clearly on screenshot below. The first item was added using Scrapy script, which has called php script(author and categories are missing), the second record was added directly from php script.
$post = array(
'post_content' => 'Content',
'post_title' => $title,
'post_status' => 'publish',
'post_type' => 'ait-dir-item',
'tags_input' => "tags",
'tax_input' => array('ait-dir-item-category' => $last_cat)
);
print_r($post);
$post_id = wp_insert_post($post);