Kinetic Pulse
  • Home
  • Services
  • Portfolio
  • Blog
  • Terms
  • Contact

Using Google API to get feed from Blogger

August 7, 2014

I had previously used the php library SimplePie to pull in blog posts from a clients Blogger blog to show on the their Zencart site.

And it worked well – until the hosts did a PHP upgrade and it stopped working (thanks 1&1!)

No matter what I tried – different versions of SimplePie, debugging lines of code – would make it work again. So I needed another solution.

Google to the rescue. Using their Google Feed API I managed to pull the feed data into the page:

<script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">

    google.load("feeds", "1");

    function initialize() {
      var feed = new google.feeds.Feed("http://lawandcompany.blogspot.com/feeds/posts/default");
      feed.setNumEntries(10);
      feed.load(function(result) {
        if (!result.error) {
          var container = document.getElementById("feed");
          for (var i = 0; i < result.feed.entries.length; i++) {
            var entry = result.feed.entries[i];
            var h2 = document.createElement("h2");
            h2.innerHTML="<a href='"+entry.link+"'>"+entry.title+"</a>";
            container.appendChild(h2);
	    var content = document.createElement("p");
            content.innerHTML = entry.content;
            container.appendChild(content)
	    var postdate = document.createElement("p");
	    var d = new Date(entry.publishedDate);
	    var curr_date = d.getDate();
	    var curr_month = d.getMonth() + 1; //Months are zero based
	    var curr_year = d.getFullYear();
             postdate.innerHTML ="<small>Posted on: "+curr_date + "-" + curr_month + "-" + curr_year+"</small>";
            container.appendChild(postdate)
          }
        }
      });
    }
    google.setOnLoadCallback(initialize);

    </script>
    <div id="feed" class="item"></div>

You can see it in action here:
http://www.lawandcompany.com/blog

Testimonials

Amazing and brilliant, Kinetic Pulse have lifted a dream to reality, Highly recommended and great if you are total novice, they know their stuff…Thanks again
Annie LindridgeSalt Yourself Out
Thank you guys so much for all that you’ve done helping us to create a really awesome website!! We get such great feedback – everyone loves it & we couldn’t be prouder! Look forward to working with you again soon!
Wild Thyme PlantsWild Thyme Plants
It’s been fab working with you – we love the site and certainly going to recommend you!
James DaviesThirty Eight Degrees North
I like it.  I like it a lot !!!

 You have interpreted what I wanted to achieve perfectly considering what you have to play with i.e not redoing the whole thing in the process.

Fiona Simmons-MooreSouth Gloucestershire Parents & Carers
Thanks so much for all your work on this, really appreciated. It’s come on in leaps and bounds since you took over.
Pete KewRedwood Strip Curtains
Thank you for all of your hard work its looks fab and I am over the moon with it!
Amanda MercerAmanda Mercer Ceramics
Absolutely fantastically professional web developer – I would highly recommend!!! Thank you so much Kinetic Pulse!
Tania MarstonDoris Designs

Twitter

@HMRCcustomers Will do - thanks for the swift response

Last year from Kinetic Pulse's Twitter

@HMRCcustomers I've submitted Self Assessment repayment requests multiple times over the past 6 months (always waiting 4 weeks between) and never has anything happened. There seems to be no way of tracking or chasing them either. Now, of all times, this is important

Last year from Kinetic Pulse's Twitter

Apologies to all clients who have had website issues today. There was a major outage for our hosting company @cloudabove but, as always, they have been fantastically open and transparent about what's going on and are working hard to restore service.

About a year ago from Kinetic Pulse's Twitter

@thegrapesbath @bathdrummer Thanks - looking forward to opening night!

About 2 years ago from Kinetic Pulse's Twitter

woobox.com/tjkbms/k1orue

About 3 years ago from Kinetic Pulse's Twitter

Copyright 2021 Kinetic Pulse