Created
May 29, 2012 01:58
-
-
Save dimmduh/2822123 to your computer and use it in GitHub Desktop.
Using Google Reader Class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$google_reader = new GoogleReaderAPI( '[email protected]', '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