How can I use wordpress functionality outside of WP framework

It’s just simple, same reply from Error in WP_update_post but in your case there is small change.

Just use wp-load.php as include. No need to include post.php. Once the wp-load.php file is included, the entire wealth of WordPress functions is provided to you.

For pull the recent post, you need to use wp_get_recent_posts() wordpress function which is from WP framework.

So your PHP code will like:

<?php 

// Include the wp-load'
include('YOUR_WP_PATH/wp-load.php');

// For example get the last 10 posts

// Returns posts as arrays instead of get_posts' objects
$recent_posts = wp_get_recent_posts(array(
    'numberposts' => 10
));

?>

Let me know if there is any doubt/query from this.

error code: 523