16

I want to build a widget for WordPress that simultaneously displays my latest Google Reader items on the front page and allows for management from behind the WordPress dashboard. I can already add my "shared" items using code I've found in various Google searches, but that's not exactly what I'm looking for.

I like the functionality of the Google Reader widget in iGoogle, and I want to replicate that on the WordPress dashboard and build a read-only version for the WordPress front-end. Where do I start in the API (public or 'unofficial') to get this built?

-- Update --

I've found some limited documentation regarding authentication protocols, but I've been unable to implement anything. I can parse a URL to authenticate and get an SSID that works when directly placed in a browser, but both GET and POST requests fail via PHP, so I can't get any further than that.

-- Update --

I've converted the first few steps of Martin Doms' C# tutorial into PHP for anyone who's interested in doing this on their own site.

ptdev
  • 453
  • 1
  • 3
  • 20
EAMann
  • 4,128
  • 2
  • 29
  • 48

3 Answers3

5

Here's a nice 3-step tutorial: http://blog.martindoms.com/2009/08/15/using-the-google-reader-api-part-1/

If you're having problems from PHP, then I think you should post the PHP code to see where it's failing. These steps should work flawlessly.

Seb
  • 24,920
  • 5
  • 67
  • 85
  • I actually started with that tutorial. And the problem with PHP isn't actually a problem with PHP ... it's a problem with authentication in general (possibly from my domain, but I'm not sure ...) I ported the C# code to PHP, and the issue occurs in the getSID() function. I can use the parsed URL (https://www.google.com/accounts...) directly in a web browser to return an SID and LSID, but both POST and GET requests via PHP throw an HTTP security violation. – EAMann May 17 '10 at 20:25
  • How are you doing those POST and GET from PHP? Using cURL function to do a GET should work just fine (http://us2.php.net/manual/en/function.curl-exec.php). If you're still having problems, posting your current code may help. – Seb May 17 '10 at 20:40
  • I'll try again with cURL and let you know what happens. – EAMann May 17 '10 at 21:01
  • cURL ended up being the magic that did the trick. After I was able to get the SID, the hardest step was passing a cookie in the GET request to return an auth token. Now everything's working beautifully, though. Thanks! – EAMann May 18 '10 at 01:59
  • Glad I could help! Don't forget to mark this answer as correct when you have the time ;) – Seb May 18 '10 at 03:20
  • I will ... it keeps telling me I have to wait. Right now it's down to 1 hour, so you'll have your bounty soon enough :-) – EAMann May 18 '10 at 14:30
  • Oh, forgot this one was a bounty one! Better yet! :) I always ask to mark as correct if they don't do it, so others can know which answer is *the* one pretty quickly. – Seb May 18 '10 at 14:35
  • 1
    I've also added a PHP version of Martin Doms' tutorial on my own site: http://mindsharestrategy.com/google-reader-api-a-brief-tutorial/ – EAMann May 21 '10 at 15:17
  • 1
    The site went dead.. Anyone knows where can i find this tut (i'm more of a c# guy :) thanks. – Nimrod Shory Aug 29 '10 at 09:47
  • Here's another C# tutorial explaining the same process: http://sandrinodimattia.net/blog/post/Consuming-Google-(Reader)-with-NET-Part-1-Authentication.aspx – EAMann Sep 03 '10 at 01:49
2

I can add some extra resources, especially the ones that resemble the most a structured documentation for this unofficial API:

Hope it helps!

ptdev
  • 453
  • 1
  • 3
  • 20
  • The Google group 'fourgrapi' is a great resource for questions that will pop-up when trying to interface with Google Reader. Thanks! +1 for sharing that – bhavinb Oct 19 '11 at 11:49
0

Following up on EAMann his PHP class is here http://code.google.com/p/greader-library/source/browse/trunk/greader.class.php?r=4. I got it working last night. Thank you Eric, I will be adding to your library.

beactive
  • 759
  • 1
  • 7
  • 12
  • Feel free to submit patches to the Issues section on Google Reader as well. Anything you can contribute will help make the library stronger! – EAMann Dec 27 '10 at 20:44