我查找了一个PHP代码示例,用于检索Evernote服务器上的注释文本。
到目前为止,我只找到了列出笔记本的简单示例,并帮助进行身份验证。但是所有引用都是针对Java而不是针对PHP,并且没有任何内容列出自己的注释。
我知道我必须使用函数findNotesMetaData但我不明白要指定什么作为第四个参数。
我需要一些帮助才能更进一步。我不知道足够的Java来理解PHP中的等价语句。提前谢谢。
皮尔
答案 0 :(得分:3)
您无法使用findNotesMetaData获取备注内容。这是用于获取注释的简单代码片段(另请参阅github上的示例以了解如何使用OAuth获取令牌)。
use EDAM\NoteStore\NoteFilter;
use Evernote\Client;
$client = new Client(array(
'token' => $accessToken,
'sandbox' => true
));
$filter = new NoteFilter();
$filter->words = "Evernote";
$notes = $client->getNoteStore()->findNotes($filter, 0, 10);
您可以查看有关搜索笔记here的详细信息。
答案 1 :(得分:0)
在github上有PHP Evernote API SDK
答案 2 :(得分:0)
不是PHP,但perl的答案如下:
use strict;
use Net::Evernote::Simple;
my $evernote = Net::Evernote::Simple->new(
# Obtain a developer token from Evernote and put it here
dev_token => 'YOUR DEV TOKEN HERE',
);
warn "Evernote API version out of date!\n" if( ! $evernote->version_check() ); # check if our client API version still works
my $note_store = $evernote->note_store() or die "getting notestore failed: $@";
my $notebooks = $note_store->listNotebooks( $evernote->dev_token() ) or die "oops:$!"; # retrieve all of our notebooks. See https://dev.evernote.com/doc/reference/ for other things you can do.
for my $notebook ( @$notebooks ) {
print "evernote->note_store->listNotebooks: " . $notebook->guid() . "\t" . $notebook->name(), "\n";
$arg{'guid'}=$notebook->guid() if($notebook->name() eq 'Some Notebook Name');
}
my $tags = $note_store->listTags( $evernote->dev_token() ) or die "oops:$!";
for my $s ( @$tags ) {
print "evernote->note_store->listTags: " . $s->guid() . "\t" . $s->name(), "\n";
}
use Data::Dumper; print Data::Dumper->Dump([ $notebooks ],['$notebooks']);
my $srch = Net::Evernote::Simple::EDAMNoteStore::NoteFilter->new() or die "oops:$!";
$srch->notebookGuid( $arg{'guid'} ) or warn "hmm: $!";
# $srch->inactive( 1 ); # set this to go through the trash
print Data::Dumper->Dump([ $srch ],['$srch']);
my $res=Net::Evernote::Simple::EDAMNoteStore::NotesMetadataResultSpec->new();
# $authenticationToken, $filter, $offset, $maxNotes, $resultSpec);
my $sr = $note_store->findNotesMetadata( $evernote->dev_token(), $srch, 0, 99999, $res) or die "oops:$!";
print Data::Dumper->Dump([ $res ],['$res']);
print Data::Dumper->Dump([ $sr ],['$sr']);
#($authenticationToken, $guid, $withContent, $withResourcesData, $withResourcesRecognition, $withResourcesAlternateData);
my $note = $note_store->getNote( $evernote->dev_token(), 'some_note_GUID_here', 1, 1, 1, 1) or die "oops:$!";
print Data::Dumper->Dump([ $note ],['$note']);
my $tags = $note_store->listTags( $evernote->dev_token() ) or die "oops:$!";
print Data::Dumper->Dump([ $tags ],['$tags']);