开发者

Problem getting codeigniter library for google reader to work when trying to log in and get feed data

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' => 'me@gmail.com', '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 开发者_JAVA百科has an idea what might be happening here.

Thanks much!


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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜