The PHP way
If you want to use PHP, you can use wp_insert_post
to insert posts programatically. Basically you want to provide an array of post information (title, content, date...). You can read more about it here: https://developer.wordpress.org/reference/functions/wp_insert_post/
But the problem is you should not run that function to import all 100 posts. I used to solve the same problem: Migrate 34k posts from old site to new site using WordPress. Here is what I did:
- Write a PHP script to crawl the post URLs of target site. I wrap it in a Page template. I use
Simple HTML DOM
to extract data from page. I append the result to the page itself.
- Still on that page, after getting all URLs I need, I use Ajax to insert post one by one. Use Simple HTML DOM to extract data, then use
wp_insert_post
to insert post to database with the crawled data
- Get URL from the list append in the previous step
- Use Simple HTML DOM to extract data from that URL
- Use
wp_insert_post
to create post with extracted data.
- Repeat that action until all done.
The CSV way
IMO, build a WordPress xml file to import is hard. You can think about a simpler alternative choice is CSV. Build a CSV file is more straight forward and simpler. Then you can use a CSV import plugin to create posts on your new site.