Wednesday, February 3, 2010

Including content from Blogger posts in another web page.

If you want to include the content of your blogger posts in another page the easiest way is with PHP.

This is the code I used to pull the data out:

<?php $url = "http://blogname.blogspot.com/index.html";
$content = file_get_contents($url);
$start = strpos($content,'<!-- google_ad_section_start(name=default) -->');
$end = strpos($content,'<!-- google_ad_section_end -->',$start);
$mycontent = substr($content,$start,$end-$start);
echo ($mycontent);
?>

Then I manipulated its formatting using CSS.

It works, but exactly where you look for the beginning and end of posts will depend on the blogger template you are using.