monterrrubio

listNotes

May 20th, 2013
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.00 KB | None | 0 0
  1. $accessToken = $_SESSION['accessToken'];
  2.             $client = new Client(array(
  3.                 'token' => $accessToken,
  4.                 'sandbox' => SANDBOX
  5.             ));
  6.             $notebooks = $client->getNoteStore()->listNotebooks();
  7.             $result = array();
  8.             $result2 = array();
  9.             if (!empty($notebooks)) {
  10.                 foreach ($notebooks as $notebook) {
  11.                     $nbguids[] = $notebook->guid;
  12.                 }
  13.  
  14.             }
  15.             if (!empty($nbguids)) {
  16.                 foreach ($nbguids as $nbguid) {
  17.                     $filter = new NoteFilter();;
  18.                     $filter->notebookGuid = $nbguid;
  19.                     $notes = $client->getNoteStore()->findNotes($accessToken, $filter, 0, 100); // Fetch up to 100 notes
  20.                     if (!empty($notes->notes)) {
  21.                     foreach ($notes->notes as $note) {
  22.                         $result[] = $note->title;
  23.                         $result2[] = $note->guid;
  24.                     }
  25.                 }
  26.             }
  27.             $_SESSION['notes_title'] = $result;
  28.             $_SESSION['notes_guid'] = $result2;
Advertisement
Add Comment
Please, Sign In to add comment