Friday, March 25, 2011
The following PHP source code can be used to generate a valid blog feed from a Thingamablog generated xml file that has been encoded to also provide data used with the Blogger Calendar.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <?php $ch = curl_init(); $url="http://blog.yourdomain.com/rss.xml"; curl_setopt ($ch, CURLOPT_URL,$url); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $result=curl_exec ($ch); curl_close ($ch); $result=get_between($result,"<?xml","<BeginCalSec>"); echo "<?xml".$result."</channel></rss>"; ?> <?php function get_between($input, $start, $end) { $substr = substr($input, strlen($start)+strpos($input, $start), (strlen($input) - strpos($input, $end))*(-1)); return $substr; } ?> |
You would place the php file "blogrss.php" in the appropriate directory, where "blogrss" is anything you specify. Then use a url similar to this: http://blog.yourdomain.com/blogrss.php when your blog feed URL is requested by services like, NetworkedBlogs or Feedburner.
This fix negates the need for server side Java support with the Thingamablog version of the Blogger Calendar.