views:

25

answers:

1

I'm trying to getting this http://www.forgottenexpanse.com/projects/ci_reader CodeIgniter library for interacting with Google Reader to work.

When following the examples on the page, this works fine:

$this->load->library('reader');
$shared_items = $this->reader->shared_items('12006118737470781753');

foreach ($shared_items['items'] as $entry) {
    echo $entry['title'];
}

But when trying to grab non-public data by loging in:

$this->load->library('reader');
$credentials = array('email' => '[email protected]', 'password' => 'mypassword');
$this->reader->initialize($credentials);

$shared_items = $this->reader->shared_items();
foreach ($shared_items['items'] as $entry) {
    echo $entry['title'];
}

I get a bunch of warnings related to line 454 of libraries/Reader.php, like this one:

Message: simplexml_load_string(): Entity: line 128: parser error : StartTag: invalid element name

I'm hoping someone has an idea what might be happening here.

Thanks much!

+1  A: 

The library you point to still uses the SID cookie to authenticate with Reader. That was deprecated a few months ago. The new preferred authentication schemes are either OAuth or ClientLogin with an authentication token; both are described at http://code.google.com/p/google-reader-api/wiki/Authentication.

In this particular case, you'll have to modify the _login function to get the Auth token out of the ClientLogin response. Once you have it, you'll also need to modify the _fetch function to include it as the Authorization header (instead of adding the cookie).

Mihai Parparita
Thanks Mihai - that certainly shines light onto it.
Simon
Author of the code here: it was indeed using the old authentication method, the library is now updated to use the ClientLogin method provided by google.
Parrots