When wordpress installation is not on the same host inbuilt wordpress function get_posts and require(‘wp-blog-header.php’); will not work. In this case to display wordpress posts out of wordpress you will need to fetch post directly from wordpress database.
<?php
include “connection.php”;
$result=mysql_query(“SELECT * FROM wp_posts WHERE post_status = ‘publish’ ORDER BY ID DESC LIMIT 10″);
while($row = mysql_fetch_array($result))
{ echo “<li>”;
echo “<h2><a href=”.$row['guid'].”>”.$row['post_title'].”</a></h2>”;
echo “<p align=’justify’>”.nl2br($row['post_content']).”</p>”;
echo “</li>”;
echo “<hr>”;
}?>
Explanation:
connection.php will have MySQL connection code for wordpress database in remote server. Assuming that your remote host supports remote mysql connections.
In next line we are querying 10 latest published post from wp_posts, assuming wp_ is your wordpress database prefix.
We have got the result, the code below it is just used to give it html format , which also includes nl2br, a function to convert new lines stored in database to HTML br tag equivalent.
If you get any problem using the code , feel free to comment. Analyzing wp_posts will give you more options for a posts to display. i.e. tags, alternate link etc..