evernote / evernote-cloud-sdk-php Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
How to move a note to a different notebook?
I am using PHP 7.4.4 and get the error Array and string offset access syntax with curly braces is deprecated
using the Evernote Client.
Example:
$token = '<token>';
$sandbox = true;
$client = new \Evernote\Client($token, $sandbox);
$notebooks = $client->listNotebooks();
This fails in src/Thrift/Transport/THttpClient.php:100
.
Changing
if ((TStringFuncFactory::create()->strlen($uri) > 0) && ($uri{0} != '/')) {
to
if ((TStringFuncFactory::create()->strlen($uri) > 0) && (substr($uri, 0, 1) != '/')) {
resolves the issue.
(I'm not sure if I could just clone the repo, create a branch, fix it and create a merge request. Please let me know if I could fix that myself as I have no experience in that.)
Trying a very simple search and it's returning 0 results when the Client::SEARCH_SCOPE_ALL
is used but has results when using Client::SEARCH_SCOPE_PERSONAL
. I would assume that the all scope would bring back the same if not more results.
$search = new \Evernote\Model\Search('Evernote');
$notebook = null;
$scope = \Evernote\Client::SEARCH_SCOPE_PERSONAL; // Has results
//$scope = \Evernote\Client::SEARCH_SCOPE_ALL; // No results
$order = \Evernote\Client::SORT_ORDER_REVERSE | \Evernote\Client::SORT_ORDER_RECENTLY_CREATED;
$maxResult = 5;
$results = $this->service->findNotesWithSearch($search, $notebook, $scope, $order, $maxResult);
Delving into this there are a number of code issues, firstly the usort
in findNotes_processResultsWithContext
is returning a boolean and not the sorted results, it probably needs to change to this:
if ($context->requiresLocalMerge) {
if ($this->isFlagSet($context->sortOrder, self::SORT_ORDER_RECENTLY_CREATED)) {
usort($context->findMetadataResults, array($this, 'compareByCreated'));
} elseif ($this->isFlagSet($context->sortOrder, self::SORT_ORDER_RECENTLY_UPDATED)) {
usort($context->findMetadataResults, array($this, 'compareByUpdated'));
} else {
usort($context->findMetadataResults, array($this, 'compareByTitle'));
}
}
Then the method can continue to run and return the results.
Secondly the findNotes_nextFindInLinkedScopeWithContext
method doesn't return anything so going back up the chain it's returning null and not the results. Probably need to add something like this:
if (count($context->linkedNotebooksToSearch) == 0) {
return $this->findNotes_processResultsWithContext($context);
}
and
$this->findNotes_nextFindInLinkedScopeWithContext($context); // not sure why this is here - would seem to loop recursively
return $this->findNotes_processResultsWithContext($context);
Again would create a pull request but already got other changes in my fork and not sure how to do multiple forks. Overall a bit disappointing using this official library, it's been a pig to work with and integrate.
I'm having trouble getting Client::getNote
to work using the current dev-master
on PHP 5.5.10.
I have a valid OAuth token, and I'm listening to webhook events. Using the payload below, I'm attempting to query the note that was just updated.
$message = [
'userId' => '287XXX',
'guid' => '8ebd7180-XXXX',
'notebookGuid' => 'd9de8217-XXXX',
'reason' => 'update'
];
Using this info, I'm attempting to fetch the note using:
$client = new \Evernote\Client($token, false); // token is valid, app is in production mode
$note = $client->getNote($message['guid']);
$notebook = $client->getNotebook($message['notebookGuid']);
In the above code, $note
is empty, whereas $notebook
returns the Evernote\Model\Notebook
object, so I'm pretty sure everything is set up as it should.
Any pointers would be greatly appreciated
all sample code , i had get that error! , please tell me how to solve it, 3q!
Fatal error: Uncaught exception 'Thrift\Exception\TTransportException' with message 'THttpClient: Could not read 4 bytes from sandbox.evernote.com:443//edam/user' in E:\ken_dev\xiche_c_apihelper\app\g\evernote\Thrift\Transport\THttpClient.php:162 Stack trace: #0 E:\ken_dev\xiche_c_apihelper\app\g\evernote\Thrift\Transport\TTransport.php(74): Thrift\Transport\THttpClient->read(4) #1 E:\ken_dev\xiche_c_apihelper\app\g\evernote\Thrift\Protocol\TBinaryProtocol.php(305): Thrift\Transport\TTransport->readAll(4) #2 E:\ken_dev\xiche_c_apihelper\app\g\evernote\Thrift\Protocol\TBinaryProtocol.php(197): Thrift\Protocol\TBinaryProtocol->readI32(NULL) #3 E:\ken_dev\xiche_c_apihelper\app\g\evernote\EDAM\UserStore\UserStore.php(710): Thrift\Protocol\TBinaryProtocol->readMessageBegin(NULL, 0, 0) #4 E:\ken_dev\xiche_c_apihelper\app\g\evernote\EDAM\UserStore\UserStore.php(679): EDAM\UserStore\UserStoreClient->recv_getNoteStoreUrl() #5 [internal function]: EDAM\UserStore\UserStoreClient->getNoteStoreUrl('S=s1:U=91183:E=...') #6 E:\ken_dev\x in E:\ken_dev\xiche_c_apihelper\app\g\evernote\Thrift\Transport\THttpClient.php on line 162
I have a daily script that does some work in my evernote.
It worked fine for the last couple of months but today I started getting this error:
THttpClient: Could not connect to www.evernote.com:443//edam/user
The code and overall setup has not changed. I can also exclude a token issue.
Now I'm wondering what the reason might be and if I just have to wait or need to get active.
Does anyone know something about this or have some hints?
I can use the sample code to create notes with text such as
$note = new \Evernote\Model\Note();
$note->title = 'Test note';
$note->content = new \Evernote\Model\PlainTextNoteContent('Some plain text content.');
But when I do something like
$resource = new \Evernote\Model\Resource("/root/BTSync/enupload/TestFiles/test.txt.pdf");
$note->addResource($resource);
It doesn't throw any errors (and if i print_r($resource) I get all the data) but the note is then created without the attachment.
There are no samples of adding a resource to a note that I can see so I may be doing it incorrectly.
Thanks for your time.
when using, as the examples, the PlainTextNoteContent
model to post a note content, we just have to use this class :
<?php
// ...
$note = new Note;
$note->content = new PlainTextNoteContent($content);
But if you need to use the EnmlNoteContent
instead, you need to decorate it with some XML first :
<?php
// ...
$content = <<<CONTENT
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">
<en-note>$content</en-note>
CONTENT;
$note = new Note;
$note->content = new EnmlNoteContent($content);
I think something is wrong on the usage here, and that the node should be able to decorate the text itself, in order to do that :
<?php
// ...
$note = new Note;
$note->content = new EnmlNoteContent($content);
Especially as this is not documented, this can be a headache if you don't know the little tip...
«
سلام
آیا کسی از دوستان برای رفع این مشکل میتونه کمک کنه؟
این ارور در وقت سینکشدن اورنوت با وردپرس ظاهر میشه
این مشکل در وردپرس 5.3.2 به وجود ماید و در نسخههای قبلی هیچ مشکلی وجود نداشت و به راحتی سینک صورت میگرفت
متن ارور:
Uncaught Exception: in ...\wp-content\plugins\evernote-sync\src\EDAM\UserStore\UserStore.php on line 3210
»
Translated with Google:
Hi
Can any of my friends help with this problem?
This error will appear when synchronizing evernote with WordPress
This problem occurs in WordPress 5.3.2 and there were no issues with previous versions
Error text:
Uncaught Exception: in ...\wp-content\plugins\evernote-sync\src\EDAM\UserStore\UserStore.php on line 3210
We are using Evernote API Development Kit version 2.0.2 (latest) for PHP and are having issues with the generated web (global) links not opening. We are using shareNote(Note $note) method of Evernote\Client (file://vendor/evernote/evernote-cloud-sdk-php/src/Evertnote/Client.php), which does return links (example: https://www.evernote.com/shard/s650/sh/04a129d8-20a4-48e9-a070-96abcfd5eef8/oLsWpJwCTUsVq3zBSXqjo7rhoA4enMsuFfqzaQrHDvdF4vleBVOeuuhjOA), but none of them open notes be it in browser or through a curl application. Error page that comes up is "Note not found".
Did anyone have similar issue?
Please note that web (global) links generated inside Evernote application work, and this is not what this issue is about. Links that are generated by the API in do not work as expected.
The API Calls made by the SDK started to get very slow since the 12th of April (more or less).
Any action that uses the userStore
takes a long time. I did some test and sometime the getUser()
method could take 3 - 4 seconds before getting a response.
Is there something we can do? or is it on Evernote's Server side?
Hi,
I am upgrading my api integration to cloud sdk php version,
When searching notes in a notebook , i am geting following error.
Fatal error: Call to undefined method Evernote\Model\Notebook::isLinked() in /var/www/clients/client1/web11/web/cronjobs/evernote-api/vendor/evernote/evernote-cloud-sdk-php/src/Evernote/Client.php on line 839
below is my search method.
function listNotes($guid,$token)
{
echo $sandbox = false;
$client = new \Evernote\Client($token, $sandbox);
/**
/**
/**
/**
/**
$results = $client->findNotesWithSearch($search, $notebook, $scope, $order, $maxResult);
debug($results);
foreach ($results as $result) {
$noteGuid = $result->guid;
$noteType = $result->type;
echo $noteTitle = $result->title;
$noteCreated = $result->created;
$noteUpdated = $result->updated;
echo "<BR>";
}
}
I just want to get all notes in a notebook with specific GUID.
Thank You.
i want to make add feature (save to evernote) in an app. like (Pocket & Instapaper).
could you help me to do this.
i know this might not be the place for this question.
if this is the case could u plz direct me to the right place.
The code has been taken from "https://cwiki.apache.org/confluence/display/Hive/HiveClient". while executing the PHP code the error occured is as follows
"Fatal error: Uncaught exception 'HiveExecuteException' with message 'HiveExecuteException: Execute Error:: TSocket: Could not read 4 bytes from localhost:10000 query:: SHOW DATABASES ' in /opt/lampp/htdocs/thrift/ThriftHiveClientEx.php:74 Stack trace: #0 /opt/lampp/htdocs/thrift/sample.php(14): ThriftHiveClientEx->execute('SHOW DATABASES') #1 {main} thrown in /opt/lampp/htdocs/thrift/ThriftHiveClientEx.php on line 74"
How to overcome this error?
Hey there I am trying to create Note on production server and getting this error.
I dont really know if its an SDK issue or something else.
Fatal error: Uncaught exception 'EDAM\Error\EDAMSystemException' in /home/evernote/public_html/vendor/evernote/evernote-cloud-sdk-php/src/EDAM/UserStore/UserStore.php:3210 Stack trace: #0 /home/evernote/public_html/vendor/evernote/evernote-cloud-sdk-php/src/EDAM/UserStore/UserStore.php(717): EDAM\UserStore\UserStore_getNoteStoreUrl_result->read(Object(Thrift\Protocol\TBinaryProtocol)) #1 /home/evernote/public_html/vendor/evernote/evernote-cloud-sdk-php/src/EDAM/UserStore/UserStore.php(678): EDAM\UserStore\UserStoreClient->recv_getNoteStoreUrl() #2 [internal function]: EDAM\UserStore\UserStoreClient->getNoteStoreUrl('S=s306:U=834b7e...') #3 /home/evernote/public_html/vendor/evernote/evernote-cloud-sdk-php/src/Evernote/Store/Store.php(38): call_user_func_array(Array, Array) #4 /home/evernote/public_html/vendor/evernote/evernote-cloud-sdk-php/src/Evernote/AdvancedClient.php(69): Evernote\Store\Store->__call('getNoteStoreUrl', Array) #5 /home/evernote/public_html/vendor/evernote/evernote-cloud-sdk-php/src/Evernote/AdvancedCli in /home/evernote/public_html/vendor/evernote/evernote-cloud-sdk-php/src/EDAM/UserStore/UserStore.php on line 3210
In this library there aren't createOrUpdateNotebookShares. I have found it in the docs https://dev.evernote.com/doc/reference/NoteStore.html#Fn_NoteStore_createOrUpdateNotebookShares
Could you add this function?
My app needs to get notified when something changed in a particular notebook. Any advise? Thanks.
How to add tags to notes?
I found this forum entry but $note->tagNames
doesnt work for me.
https://github.com/evernote/evernote-cloud-sdk-php/blob/master/src/Evernote/Client.php#L326
This kind of mess up every possible treatments. I think the error should be ignored, and logged if there is a Logger (How about asking for a PSR Logger, and use a NullLogger if there is none ?)
I'll try to make a PR on that if you like the idea.
Hi,
I've been trying your code and the OAuth process work like a charm. However, I've tried to create a note and I receive the following error when using
$note->content = new \Evernote\Model\HtmlNoteContent($noteBody);
instead of
$note->content = new \Evernote\Model\PlainTextNoteContent('Some plain text content.');
Error:
Fatal error: Class 'HTMLPurifier' not found in /homepath/src/Evernote/Enml/HtmlCleaner/HtmlPurifier.php on line 13
Is something missing in the code? Will the ENMLNoteContent work?
Regards!
Got the following error message:
Fatal error: Call to undefined function Evernote\File\finfo_open() in /home/myusername/evernote/vendor/evernote/evernote-cloud-sdk-php/src/Evernote/File/File.php on line 76
How to fix this? Thanks
Line 1115 of Evernote/Client.php should be:
if ($notebook->isLinkedNotebook() && !$notebook->isBusinessNotebook()) {
Instead of:
if ($notebook->isLinked() && !$notebook->isBusinessNotebook()) {
Currently throwing a:
Call to undefined method Evernote\Model\Notebook::isLinked()
error
Would create a pull request myself however I've already forked the project for other minor changes.
I have applied for a temporary token and received user authorization.
But when I got the access token, I got:
Oops, we encountered an error.
I constructed an url to obtain the access token and access it through the browser, here is the url:
https://sandbox.evernote.com/oauth?oauth_consumer_key=badtudou&oauth_token=badtudou.xxxxxxxxxxxxxxxxxxxxxxxxxxxx&oauth_verifier=D0361771C900B9530805BCFFABE999BD&oauth_nonce=d0b87b738748c02fe2c4c9e1bad55005&oauth_signature=p1y15nmRfHrv6OidmQ2dqGBthro=&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1501412888&oauth_version=1.0
xxxxxxxxxxxxx is my intention to write for privacy
Or, can you give a sample of PHP from obtaining temporary tokens to obtaining access tokens?
Thank you very much!
I am working in the oauth processing at the first step,How do I solve this problem?I am sorry for English is not my mother language and poor expression.
Using the latest tagged release, I have a check to verify the user's token is valid. I'm currently doing it like this:
$client = new \Evernote\Client($connection['credentials_token'], false);
$advancedClient = $client->getAdvancedClient();
$userStore = $advancedClient->getUserStore();
try {
$user = $userStore->getUser();
} catch (EDAM\Error\EDAMUserException $e) {
if ($e->parameter == 'authenticationToken') {
$this->disableConnection(null, 'Authorization has expired', 401);
}
}
This works well 99% of cases, but randomly it crashes with the error below. Is there perhaps something I'm doing wrong?
PHP Fatal error: Uncaught exception 'EDAM\Error\EDAMSystemException' in /mnt/task/lib/evernote/evernote-cloud-sdk-php/src/EDAM/UserStore/UserStore.php:2611
Stack trace:
#0 /mnt/task/lib/evernote/evernote-cloud-sdk-php/src/EDAM/UserStore/UserStore.php(543): EDAM\UserStore\UserStore_getUser_result->read(Object(Thrift\Protocol\TBinaryProtocol))
#1 /mnt/task/lib/evernote/evernote-cloud-sdk-php/src/EDAM/UserStore/UserStore.php(504): EDAM\UserStore\UserStoreClient->recv_getUser()
#2 [internal function]: EDAM\UserStore\UserStoreClient->getUser('S=s367:U=3c7c31...')
#3 /mnt/task/lib/evernote/evernote-cloud-sdk-php/src/Evernote/Store/Store.php(50): call_user_func_array(Array, Array)
#4 /mnt/task/lib/whatsup-evernote/EvernoteModel.php(27): Evernote\Store\Store->__call('getUser', Array)
#5 /mnt/task/lib/whatsup-evernote/EvernoteModel.php(27): Evernote\Store\Store->getUser()
#6 /mnt/task/lib/whatsup/WhatsUp.php(131): EvernoteModel->process(Array, '8g2hasu7498712gyf2yrtF...')
#7 /mnt/task/lib/whatsup/WhatsUp.php(57): WhatsUp->__processQueue(Arra in /mnt/task/lib/evernote/evernote-cloud-sdk-php/src/EDAM/UserStore/UserStore.php on line 2611
PS: If there's a better way to do this, I'm all ears!
Hi,
I'm using your PHP SDK in a Laravel Notification channel - in order to require a stable version, you should consider tagging a release of this SDK and updating it at packagist.
Trying to use this package within a Laravel app and i'm receiving the error:
ErrorException in OauthHandler.php line 53:
"A session had already been started - ignoring session_start()"
I was able to comment this out and still have success with authenticating locally, but I will have to branch and modify this to work on production.
Not sure if this package should manage session_start at all. Open to suggestions :)
Newer version of tijsverkoyen/css-to-inline-styles
is available (2.2.0). It would be good to keep dependencies either updated or not locked to a specific version, instead, leave it as a "minimum required" version
en-todo checkboxes are always checked in HTML5 Documents.
PHP Sample
/** @var \Evernote\Enml\Converter\EnmlToHtmlConverter */
$converter = $note->getContent()->getHtmlConverter();
$content = $converter->convertToHtml($note->getContent()->toEnml());
Original XSLT
<xsl:template match="en-todo">
<input type="checkbox" value="1" checked="{@checked}"/>
</xsl:template>
Working XSLT
<xsl:template match="en-todo">
<xsl:choose>
<xsl:when test="@checked='true'">
<input type="checkbox" value="1" checked="checked"/>
</xsl:when>
<xsl:otherwise>
<input type="checkbox" value="1"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
How can I get/find/search notes from the linked/shared notebooks?
I have notebook guid, but method findNotesWithSearch
don't want to get data from linked notebook.
I use a token authentication (without Auth)
We've developed a website which includes Evernote intergration for creating notes.
Everything works fine, with the production server, for our test acounts.
When our client attempts to connect their account they are seeing the following error;
EDAM\Error\EDAMNotFoundException in /var/www/html/vendor/evernote/evernote-cloud-sdk-php/src/EDAM/NoteStore/NoteStore.php:21493
This is happening on a call to listNotebooks() on the evernote client like so;
$client = new \Evernote\Client($config->EvernoteToken, false);
$notebooks = array();
$notebooks = $client->listNotebooks();
Digging into the evernote code it looks like the problematic causing part is the function: listLinkedNotebooks() from the class: Evernote\Client (377)
The client account has a lot of existing Notes and Notebooks.
It's possible some of the notebooks are shared, is there an additional permission our app needs to access them?
or is there a call we can use to look up a specific notebook by name?
We are getting the following error for one customer so far :
ErrorException
Undefined index: 31ec...
(GUID)
In the following lines starting at src/Evernote/Client.php:315
foreach ($linkedNotebooks as $linkedNotebook) {
if (array_key_exists($linkedNotebook->shareKey, $sharedBusinessNotebooks)) {
$sharedNotebook = $sharedBusinessNotebooks[$linkedNotebook->shareKey];
$businessNotebook = $businessNotebooksGuids[$sharedNotebook->notebookGuid];
...
It looks like a notebook was found in linkedNotebooks that was also available in sharedBusinessNotebooks but was not found in businessNotebooksGuids which comes from :
$businessNotebooks = $this->getBusinessLinkedNotebooks();
foreach ($businessNotebooks as $businessNotebook) {
$businessNotebooksGuids[$businessNotebook->guid] = $businessNotebook;
}
I'm not certain of the intent and am wondering if the problem is that the linked notebook wasn't in the business link notebook array or if expecting it to always be there is the issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.