Skip to content

Instantly share code, notes, and snippets.

@dimmduh
Created May 29, 2012 01:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dimmduh/2822123 to your computer and use it in GitHub Desktop.
Save dimmduh/2822123 to your computer and use it in GitHub Desktop.
Using Google Reader Class
<?php
$google_reader = new GoogleReaderAPI( 'gmail@gmail.com', 'password' );
$unread_items = $google_reader ->get_unread(50);
foreach( $unread_items -> items as $val ){
//print_r( $val );
$ar_news = array(
'title' => $val -> title,
'text' => $val -> summary -> content,
'original_url' => $val -> alternate[0] -> href,
'reader_id' => $val -> id,
'created' => date( 'Y-m-d H:i:s'),
'modified' => date( 'Y-m-d H:i:s'),
);
//print_r( $ar_news );
if ($db -> insert_ar('novosti365_posts', $ar_news) ){
if ( $google_reader -> set_state( $val -> id, 'read' ) ){
} else {
error_log('Cannot set read state for id = '.$val -> id, 0);
}
} else {
error_log('Cannot insert row into database id = '.$val -> id, 0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment